Struct stam::Annotation
source · pub struct Annotation { /* private fields */ }Expand description
Annotation represents a particular instance of annotation and is the central
concept of the model. They can be considered the primary nodes of the graph model. The
instance of annotation is strictly decoupled from the data or key/value of the
annotation (AnnotationData). After all, multiple instances can be annotated
with the same label (multiple annotations may share the same annotation data).
Moreover, an Annotation can have multiple annotation data associated.
The result is that multiple annotations with the exact same content require less storage
space, and searching and indexing is facilitated.
Implementations§
source§impl Annotation
impl Annotation
sourcepub fn to_json_string(
&self,
store: &AnnotationStore
) -> Result<String, StamError>
pub fn to_json_string( &self, store: &AnnotationStore ) -> Result<String, StamError>
Writes an Annotation to one big STAM JSON string, with appropriate formatting
source§impl Annotation
impl Annotation
sourcepub fn data(&self) -> Iter<'_, (AnnotationDataSetHandle, AnnotationDataHandle)>
pub fn data(&self) -> Iter<'_, (AnnotationDataSetHandle, AnnotationDataHandle)>
Iterate over the annotation data, returns tuples of internal IDs for (annotationset,annotationdata)
For a higher-level method, use ResultItem<Annotation>::data() instead.
sourcepub fn raw_data(&self) -> &[(AnnotationDataSetHandle, AnnotationDataHandle)]
pub fn raw_data(&self) -> &[(AnnotationDataSetHandle, AnnotationDataHandle)]
Provides access to the raw underlying data
sourcepub fn data_by_index(
&self,
index: usize
) -> Option<&(AnnotationDataSetHandle, AnnotationDataHandle)>
pub fn data_by_index( &self, index: usize ) -> Option<&(AnnotationDataSetHandle, AnnotationDataHandle)>
Low-level method that returns raw data (handles) at specified index
pub fn has_data( &self, set: AnnotationDataSetHandle, handle: AnnotationDataHandle ) -> bool
Trait Implementations§
source§impl Clone for Annotation
impl Clone for Annotation
source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl DataSize for Annotation
impl DataSize for Annotation
source§const IS_DYNAMIC: bool = true
const IS_DYNAMIC: bool = true
true, the type has a heap size that can vary at runtime, depending on the actual value.source§const STATIC_HEAP_SIZE: usize = 8usize
const STATIC_HEAP_SIZE: usize = 8usize
IS_DYNAMIC is false, this is
the total amount of heap memory occupied by the value. Otherwise this is a lower bound.source§fn estimate_heap_size(&self) -> usize
fn estimate_heap_size(&self) -> usize
source§impl Debug for Annotation
impl Debug for Annotation
source§impl<'bytes, Ctx> Decode<'bytes, Ctx> for Annotation
impl<'bytes, Ctx> Decode<'bytes, Ctx> for Annotation
source§impl<Ctx> Encode<Ctx> for Annotation
impl<Ctx> Encode<Ctx> for Annotation
source§impl PartialEq for Annotation
impl PartialEq for Annotation
source§fn eq(&self, other: &Annotation) -> bool
fn eq(&self, other: &Annotation) -> bool
self and other values to be equal, and is used
by ==.source§impl<'a> Request<Annotation> for AnnotationHandle
impl<'a> Request<Annotation> for AnnotationHandle
source§fn to_handle<'store, S>(&self, _store: &'store S) -> Option<AnnotationHandle>where
S: StoreFor<Annotation>,
fn to_handle<'store, S>(&self, _store: &'store S) -> Option<AnnotationHandle>where
S: StoreFor<Annotation>,
source§fn requested_id(&self) -> Option<&str>
fn requested_id(&self) -> Option<&str>
source§fn requested_id_owned(self) -> Option<String>
fn requested_id_owned(self) -> Option<String>
source§fn requested_handle(&self) -> Option<T::HandleType>
fn requested_handle(&self) -> Option<T::HandleType>
source§impl SelfSelector for Annotation
impl SelfSelector for Annotation
source§impl Storable for Annotation
impl Storable for Annotation
type HandleType = AnnotationHandle
type StoreHandleType = ()
type FullHandleType = <Annotation as Storable>::HandleType
type StoreType = AnnotationStore
source§fn handle(&self) -> Option<Self::HandleType>
fn handle(&self) -> Option<Self::HandleType>
StoreFor<T>, this may return None only in the initial
stage when it is still unbounded to a store, so this is almost always safe to unwrap when used in the public API.source§fn with_handle(self, handle: Self::HandleType) -> Self
fn with_handle(self, handle: Self::HandleType) -> Self
source§fn carries_id() -> bool
fn carries_id() -> bool
fn fullhandle( _parenthandle: Self::StoreHandleType, handle: Self::HandleType ) -> Self::FullHandleType
source§fn handle_or_err(&self) -> Result<Self::HandleType, StamError>
fn handle_or_err(&self) -> Result<Self::HandleType, StamError>
Self::handle() but returns a StamError::Unbound error if there is no internal id.source§fn temp_id(&self) -> Result<String, StamError>
fn temp_id(&self) -> Result<String, StamError>
source§fn as_resultitem<'store>(
&'store self,
store: &'store Self::StoreType,
rootstore: &'store AnnotationStore
) -> ResultItem<'store, Self>where
Self: Sized,
fn as_resultitem<'store>(
&'store self,
store: &'store Self::StoreType,
rootstore: &'store AnnotationStore
) -> ResultItem<'store, Self>where
Self: Sized,
T as a ResultItem<T>, i.e. a wrapped reference that includes a reference to
both this item as well as the store that owns it. All high-level API functions are implemented
on such Result types. You should not need to invoke this yourself.source§fn generate_id(self, idmap: Option<&mut IdMap<Self::HandleType>>) -> Selfwhere
Self: Sized,
fn generate_id(self, idmap: Option<&mut IdMap<Self::HandleType>>) -> Selfwhere
Self: Sized,
source§impl StoreFor<Annotation> for AnnotationStore
impl StoreFor<Annotation> for AnnotationStore
source§fn store(&self) -> &Store<Annotation>
fn store(&self) -> &Store<Annotation>
source§fn store_mut(&mut self) -> &mut Store<Annotation>
fn store_mut(&mut self) -> &mut Store<Annotation>
source§fn idmap(&self) -> Option<&IdMap<AnnotationHandle>>
fn idmap(&self) -> Option<&IdMap<AnnotationHandle>>
source§fn idmap_mut(&mut self) -> Option<&mut IdMap<AnnotationHandle>>
fn idmap_mut(&mut self) -> Option<&mut IdMap<AnnotationHandle>>
fn store_typeinfo() -> &'static str
source§fn insert(&mut self, item: T) -> Result<T::HandleType, StamError>
fn insert(&mut self, item: T) -> Result<T::HandleType, StamError>
source§fn add(self, item: T) -> Result<Self, StamError>where
Self: Sized,
fn add(self, item: T) -> Result<Self, StamError>where
Self: Sized,
source§unsafe fn get_unchecked(&self, handle: T::HandleType) -> Option<&T>
unsafe fn get_unchecked(&self, handle: T::HandleType) -> Option<&T>
source§fn get(&self, item: impl Request<T>) -> Result<&T, StamError>
fn get(&self, item: impl Request<T>) -> Result<&T, StamError>
AnnotationStore::annotation() instead.source§fn get_mut(&mut self, item: impl Request<T>) -> Result<&mut T, StamError>
fn get_mut(&mut self, item: impl Request<T>) -> Result<&mut T, StamError>
source§fn remove(&mut self, handle: T::HandleType) -> Result<(), StamError>
fn remove(&mut self, handle: T::HandleType) -> Result<(), StamError>
source§fn resolve_id(&self, id: &str) -> Result<T::HandleType, StamError>
fn resolve_id(&self, id: &str) -> Result<T::HandleType, StamError>
source§fn iter(&self) -> StoreIter<'_, T>where
T: Storable<StoreType = Self>,
fn iter(&self) -> StoreIter<'_, T>where
T: Storable<StoreType = Self>,
annotations(), resources() instead.