pub struct ElementReference<T, K> { /* private fields */ }Expand description
The element of the kind K named name in the target target. Saved
as {"target": "/:s1", "name": "c3"}, its target spelled as a
Located — /bolt:s1 in the part placed as bolt; in a target of
the part itself that is its only one of its type
(HasElements::SINGLETON) as "c3"; the whole target
(ElementReference::whole) as {"target": "/:s1"}.
Implementations§
Source§impl<T, K> ElementReference<T, K>
impl<T, K> ElementReference<T, K>
pub fn new(target: TargetReference<T>, name: impl Into<String>) -> Self
Sourcepub fn target(&self) -> &TargetReference<T>
pub fn target(&self) -> &TargetReference<T>
The target the element is in.
Sourcepub fn instance(&self) -> &str
pub fn instance(&self) -> &str
The path of the instance the element is of: empty for one of the
part itself (see [crate::instance]).
Source§impl<T: HasElements<K>, K: Kind> ElementReference<T, K>
impl<T: HasElements<K>, K: Kind> ElementReference<T, K>
Sourcepub fn whole(target: TargetReference<T>) -> Self
pub fn whole(target: TargetReference<T>) -> Self
The whole of target, as its element of the empty name: for a
target meant to be read whole, which is a kind of its own (see
HasElements).
Sourcepub fn in_singleton(name: impl Into<String>) -> GeopResult<Self>
pub fn in_singleton(name: impl Into<String>) -> GeopResult<Self>
The element name of the singleton target (HasElements::SINGLETON).
Sourcepub fn from_picked(picked: &PickedElement) -> Option<Self>
pub fn from_picked(picked: &PickedElement) -> Option<Self>
The reference picked is, if it picked an element of the kind K
of a target of the type T — of the part itself, or of an instance
placed in it.
Sourcepub fn picked(&self) -> PickedElement
pub fn picked(&self) -> PickedElement
The reference as a pick names it: what the front end shows selected.