Enum stam::BuildItem

source ·
pub enum BuildItem<'a, T>
where T: Storable,
{ Id(String), IdRef(&'a str), Ref(&'a T), Handle(T::HandleType), None, }
Expand description

BuildItem offers various ways of referring to a data structure of type T in the core STAM model It abstracts over public IDs (both owned an and borrowed), handles, and references.

Variants§

§

Id(String)

§

IdRef(&'a str)

§

Ref(&'a T)

§

Handle(T::HandleType)

§

None

Implementations§

source§

impl<'a, T> BuildItem<'a, T>
where T: Storable,

source

pub fn is_handle(&self) -> bool

source

pub fn is_id(&self) -> bool

source

pub fn is_none(&self) -> bool

source

pub fn is_some(&self) -> bool

source

pub fn to_string(self) -> Option<String>

Returns the ID as a new string, returns None if only handle is contained

source

pub fn as_str<'slf>(&'slf self) -> Option<&'slf str>

Returns the ID as str, returns None if only handle is contained

Trait Implementations§

source§

impl<'a, T> Clone for BuildItem<'a, T>
where T: Storable,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a, T> Debug for BuildItem<'a, T>
where T: Storable + Debug, T::HandleType: Debug,

source§

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

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

impl<'a, T> Default for BuildItem<'a, T>
where T: Storable,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de: 'a, 'a, T> Deserialize<'de> for BuildItem<'a, T>
where T: Storable,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

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

impl From<&AnnotationDataHandle> for BuildItem<'_, AnnotationData>

source§

fn from(handle: &AnnotationDataHandle) -> Self

Converts to this type from the input type.
source§

impl From<&AnnotationDataSetHandle> for BuildItem<'_, AnnotationDataSet>

source§

fn from(handle: &AnnotationDataSetHandle) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&AnnotationHandle> for BuildItem<'a, Annotation>

source§

fn from(handle: &AnnotationHandle) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&DataKeyHandle> for BuildItem<'a, DataKey>

source§

fn from(handle: &DataKeyHandle) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&ResultItem<'a, T>> for BuildItem<'a, T>
where T: Storable,

source§

fn from(result: &ResultItem<'a, T>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a String> for BuildItem<'a, T>
where T: Storable,

source§

fn from(id: &'a String) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a T> for BuildItem<'a, T>
where T: Storable,

source§

fn from(instance: &'a T) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&TextResourceHandle> for BuildItem<'a, TextResource>

source§

fn from(handle: &TextResourceHandle) -> Self

Converts to this type from the input type.
source§

impl<'a> From<&TextSelectionHandle> for BuildItem<'a, TextSelection>

source§

fn from(handle: &TextSelectionHandle) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<&'a str> for BuildItem<'a, T>
where T: Storable,

source§

fn from(id: &'a str) -> Self

Converts to this type from the input type.
source§

impl From<AnnotationDataHandle> for BuildItem<'_, AnnotationData>

source§

fn from(handle: AnnotationDataHandle) -> Self

Converts to this type from the input type.
source§

impl From<AnnotationDataSetHandle> for BuildItem<'_, AnnotationDataSet>

source§

fn from(handle: AnnotationDataSetHandle) -> Self

Converts to this type from the input type.
source§

impl<'a> From<AnnotationHandle> for BuildItem<'a, Annotation>

source§

fn from(handle: AnnotationHandle) -> Self

Converts to this type from the input type.
source§

impl<'a> From<DataKeyHandle> for BuildItem<'a, DataKey>

source§

fn from(handle: DataKeyHandle) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Option<&AnnotationHandle>> for BuildItem<'a, Annotation>

source§

fn from(handle: Option<&AnnotationHandle>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Option<&DataKeyHandle>> for BuildItem<'a, DataKey>

source§

fn from(handle: Option<&DataKeyHandle>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Option<&TextResourceHandle>> for BuildItem<'a, TextResource>

source§

fn from(handle: Option<&TextResourceHandle>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Option<&TextSelectionHandle>> for BuildItem<'a, TextSelection>

source§

fn from(handle: Option<&TextSelectionHandle>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<Option<&'a str>> for BuildItem<'a, T>
where T: Storable,

source§

fn from(id: Option<&'a str>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Option<AnnotationHandle>> for BuildItem<'a, Annotation>

source§

fn from(handle: Option<AnnotationHandle>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Option<DataKeyHandle>> for BuildItem<'a, DataKey>

source§

fn from(handle: Option<DataKeyHandle>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<Option<String>> for BuildItem<'a, T>
where T: Storable,

source§

fn from(id: Option<String>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Option<TextResourceHandle>> for BuildItem<'a, TextResource>

source§

fn from(handle: Option<TextResourceHandle>) -> Self

Converts to this type from the input type.
source§

impl<'a> From<Option<TextSelectionHandle>> for BuildItem<'a, TextSelection>

source§

fn from(handle: Option<TextSelectionHandle>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<Option<usize>> for BuildItem<'a, T>
where T: Storable,

source§

fn from(handle: Option<usize>) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<String> for BuildItem<'a, T>
where T: Storable,

source§

fn from(id: String) -> Self

Converts to this type from the input type.
source§

impl<'a> From<TextResourceHandle> for BuildItem<'a, TextResource>

source§

fn from(handle: TextResourceHandle) -> Self

Converts to this type from the input type.
source§

impl<'a> From<TextSelectionHandle> for BuildItem<'a, TextSelection>

source§

fn from(handle: TextSelectionHandle) -> Self

Converts to this type from the input type.
source§

impl<'a, T> From<usize> for BuildItem<'a, T>
where T: Storable,

source§

fn from(handle: usize) -> Self

Converts to this type from the input type.
source§

impl<'a, T> PartialEq<&str> for BuildItem<'a, T>
where T: Storable,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, T> PartialEq<String> for BuildItem<'a, T>
where T: Storable,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, T> PartialEq<str> for BuildItem<'a, T>
where T: Storable,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, T> PartialEq for BuildItem<'a, T>
where T: Storable,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, T> Request<T> for &BuildItem<'a, T>
where T: Storable,

source§

fn to_handle<'store, S>(&self, store: &'store S) -> Option<T::HandleType>
where S: StoreFor<T>,

Returns the handle for this item, looking it up in the store
source§

fn requested_id(&self) -> Option<&str>

If this type encapsulates an Id, this returns it (borrowed)
source§

fn requested_id_owned(self) -> Option<String>

If this type encapsulates an Id, this returns it (oened)
source§

fn requested_handle(&self) -> Option<T::HandleType>

If this type encapsulates a handle, this returns it
source§

fn any(&self) -> bool

Represents a request for any value in certain contexts
source§

impl<'a, T> Request<T> for BuildItem<'a, T>
where T: Storable,

source§

fn to_handle<'store, S>(&self, store: &'store S) -> Option<T::HandleType>
where S: StoreFor<T>,

Returns the handle for this item, looking it up in the store
source§

fn requested_id(&self) -> Option<&str>

If this type encapsulates an Id, this returns it (borrowed)
source§

fn requested_id_owned(self) -> Option<String>

If this type encapsulates an Id, this returns it (oened)
source§

fn requested_handle(&self) -> Option<T::HandleType>

If this type encapsulates a handle, this returns it
source§

fn any(&self) -> bool

Represents a request for any value in certain contexts

Auto Trait Implementations§

§

impl<'a, T> RefUnwindSafe for BuildItem<'a, T>

§

impl<'a, T> Send for BuildItem<'a, T>
where T: Sync, <T as Storable>::HandleType: Send,

§

impl<'a, T> Sync for BuildItem<'a, T>
where T: Sync, <T as Storable>::HandleType: Sync,

§

impl<'a, T> Unpin for BuildItem<'a, T>
where <T as Storable>::HandleType: Unpin,

§

impl<'a, T> UnwindSafe for BuildItem<'a, T>

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

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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

§

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

§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

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