Skip to main content

ElementReference

Struct ElementReference 

Source
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>

Source

pub fn new(target: TargetReference<T>, name: impl Into<String>) -> Self

Source

pub fn target(&self) -> &TargetReference<T>

The target the element is in.

Source

pub fn name(&self) -> &str

The element’s stable name in its target.

Source

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

pub fn local(&self) -> Self

The same element as its instance’s own part names it: itself, for one of the part itself.

Source

pub fn behind(&self, instance: &str) -> Self

The same element of the instance instance of the part — of the instance at that path, if it is already of one: what an element of a placed part is, read from the part it is placed in.

Source§

impl<T: HasElements<K>, K: Kind> ElementReference<T, K>

Source

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).

Source

pub fn in_singleton(name: impl Into<String>) -> GeopResult<Self>

The element name of the singleton target (HasElements::SINGLETON).

Source

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.

Source

pub fn picked(&self) -> PickedElement

The reference as a pick names it: what the front end shows selected.

Trait Implementations§

Source§

impl<T, K> Clone for ElementReference<T, K>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, K: Kind> Debug for ElementReference<T, K>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de, T: HasElements<K>, K: Kind> Deserialize<'de> for ElementReference<T, K>

Source§

fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T, K> Eq for ElementReference<T, K>

Source§

impl<T, K> PartialEq for ElementReference<T, K>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: HasElements<K>, K: Kind> Serialize for ElementReference<T, K>

Source§

fn serialize<Se: Serializer>(&self, serializer: Se) -> Result<Se::Ok, Se::Error>

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl<T, K> Freeze for ElementReference<T, K>

§

impl<T, K> RefUnwindSafe for ElementReference<T, K>

§

impl<T, K> Send for ElementReference<T, K>

§

impl<T, K> Sync for ElementReference<T, K>

§

impl<T, K> Unpin for ElementReference<T, K>

§

impl<T, K> UnsafeUnpin for ElementReference<T, K>

§

impl<T, K> UnwindSafe for ElementReference<T, K>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.