pub enum Item<'a, T>where
T: Storable,{
Id(String),
IdRef(&'a str),
Ref(&'a T),
Handle(T::HandleType),
None,
}Expand description
Item 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§
Implementations§
source§impl<'a, T> Item<'a, T>where
T: Storable,
impl<'a, T> Item<'a, T>where T: Storable,
pub fn is_handle(&self) -> bool
pub fn is_id(&self) -> bool
pub fn is_none(&self) -> bool
pub fn is_some(&self) -> bool
pub fn error(&self, contextmsg: &'static str) -> StamError
Trait Implementations§
source§impl<'de: 'a, 'a, T> Deserialize<'de> for Item<'a, T>where
T: Storable,
impl<'de: 'a, 'a, T> Deserialize<'de> for Item<'a, T>where T: Storable,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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<'a> From<&AnnotationDataHandle> for Item<'a, AnnotationData>
impl<'a> From<&AnnotationDataHandle> for Item<'a, AnnotationData>
source§fn from(handle: &AnnotationDataHandle) -> Self
fn from(handle: &AnnotationDataHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<&AnnotationDataSetHandle> for Item<'a, AnnotationDataSet>
impl<'a> From<&AnnotationDataSetHandle> for Item<'a, AnnotationDataSet>
source§fn from(handle: &AnnotationDataSetHandle) -> Self
fn from(handle: &AnnotationDataSetHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<&AnnotationHandle> for Item<'a, Annotation>
impl<'a> From<&AnnotationHandle> for Item<'a, Annotation>
source§fn from(handle: &AnnotationHandle) -> Self
fn from(handle: &AnnotationHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<&DataKeyHandle> for Item<'a, DataKey>
impl<'a> From<&DataKeyHandle> for Item<'a, DataKey>
source§fn from(handle: &DataKeyHandle) -> Self
fn from(handle: &DataKeyHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<&TextResourceHandle> for Item<'a, TextResource>
impl<'a> From<&TextResourceHandle> for Item<'a, TextResource>
source§fn from(handle: &TextResourceHandle) -> Self
fn from(handle: &TextResourceHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<AnnotationDataHandle> for Item<'a, AnnotationData>
impl<'a> From<AnnotationDataHandle> for Item<'a, AnnotationData>
source§fn from(handle: AnnotationDataHandle) -> Self
fn from(handle: AnnotationDataHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<AnnotationDataSetHandle> for Item<'a, AnnotationDataSet>
impl<'a> From<AnnotationDataSetHandle> for Item<'a, AnnotationDataSet>
source§fn from(handle: AnnotationDataSetHandle) -> Self
fn from(handle: AnnotationDataSetHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<AnnotationHandle> for Item<'a, Annotation>
impl<'a> From<AnnotationHandle> for Item<'a, Annotation>
source§fn from(handle: AnnotationHandle) -> Self
fn from(handle: AnnotationHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<DataKeyHandle> for Item<'a, DataKey>
impl<'a> From<DataKeyHandle> for Item<'a, DataKey>
source§fn from(handle: DataKeyHandle) -> Self
fn from(handle: DataKeyHandle) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<&AnnotationDataHandle>> for Item<'a, AnnotationData>
impl<'a> From<Option<&AnnotationDataHandle>> for Item<'a, AnnotationData>
source§fn from(handle: Option<&AnnotationDataHandle>) -> Self
fn from(handle: Option<&AnnotationDataHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<&AnnotationDataSetHandle>> for Item<'a, AnnotationDataSet>
impl<'a> From<Option<&AnnotationDataSetHandle>> for Item<'a, AnnotationDataSet>
source§fn from(handle: Option<&AnnotationDataSetHandle>) -> Self
fn from(handle: Option<&AnnotationDataSetHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<&AnnotationHandle>> for Item<'a, Annotation>
impl<'a> From<Option<&AnnotationHandle>> for Item<'a, Annotation>
source§fn from(handle: Option<&AnnotationHandle>) -> Self
fn from(handle: Option<&AnnotationHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<&DataKeyHandle>> for Item<'a, DataKey>
impl<'a> From<Option<&DataKeyHandle>> for Item<'a, DataKey>
source§fn from(handle: Option<&DataKeyHandle>) -> Self
fn from(handle: Option<&DataKeyHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<&TextResourceHandle>> for Item<'a, TextResource>
impl<'a> From<Option<&TextResourceHandle>> for Item<'a, TextResource>
source§fn from(handle: Option<&TextResourceHandle>) -> Self
fn from(handle: Option<&TextResourceHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<AnnotationDataHandle>> for Item<'a, AnnotationData>
impl<'a> From<Option<AnnotationDataHandle>> for Item<'a, AnnotationData>
source§fn from(handle: Option<AnnotationDataHandle>) -> Self
fn from(handle: Option<AnnotationDataHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<AnnotationDataSetHandle>> for Item<'a, AnnotationDataSet>
impl<'a> From<Option<AnnotationDataSetHandle>> for Item<'a, AnnotationDataSet>
source§fn from(handle: Option<AnnotationDataSetHandle>) -> Self
fn from(handle: Option<AnnotationDataSetHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<AnnotationHandle>> for Item<'a, Annotation>
impl<'a> From<Option<AnnotationHandle>> for Item<'a, Annotation>
source§fn from(handle: Option<AnnotationHandle>) -> Self
fn from(handle: Option<AnnotationHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<DataKeyHandle>> for Item<'a, DataKey>
impl<'a> From<Option<DataKeyHandle>> for Item<'a, DataKey>
source§fn from(handle: Option<DataKeyHandle>) -> Self
fn from(handle: Option<DataKeyHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<Option<TextResourceHandle>> for Item<'a, TextResource>
impl<'a> From<Option<TextResourceHandle>> for Item<'a, TextResource>
source§fn from(handle: Option<TextResourceHandle>) -> Self
fn from(handle: Option<TextResourceHandle>) -> Self
Converts to this type from the input type.
source§impl<'a> From<TextResourceHandle> for Item<'a, TextResource>
impl<'a> From<TextResourceHandle> for Item<'a, TextResource>
source§fn from(handle: TextResourceHandle) -> Self
fn from(handle: TextResourceHandle) -> Self
Converts to this type from the input type.
source§impl<'a, T> PartialEq<&str> for Item<'a, T>where
T: Storable,
impl<'a, T> PartialEq<&str> for Item<'a, T>where T: Storable,
This allows us to pass a reference to any stored item and get back the best AnyId for it Will panic on totally unbounded that also don’t have a public ID
source§impl<'a, T> PartialEq<Item<'a, T>> for Item<'a, T>where
T: Storable,
impl<'a, T> PartialEq<Item<'a, T>> for Item<'a, T>where T: Storable,
source§impl<'a, T> PartialEq<String> for Item<'a, T>where
T: Storable,
impl<'a, T> PartialEq<String> for Item<'a, T>where T: Storable,
Auto Trait Implementations§
impl<'a, T> RefUnwindSafe for Item<'a, T>where T: RefUnwindSafe, <T as Storable>::HandleType: RefUnwindSafe,
impl<'a, T> Send for Item<'a, T>where T: Sync, <T as Storable>::HandleType: Send,
impl<'a, T> Sync for Item<'a, T>where T: Sync, <T as Storable>::HandleType: Sync,
impl<'a, T> Unpin for Item<'a, T>where <T as Storable>::HandleType: Unpin,
impl<'a, T> UnwindSafe for Item<'a, T>where T: RefUnwindSafe, <T as Storable>::HandleType: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more