Struct stam::AnnotationData
source · pub struct AnnotationData { /* private fields */ }Expand description
AnnotationData holds the actual content of an annotation; a key/value pair. (the
term feature is regularly seen for this in certain annotation paradigms).
Annotation Data is deliberately decoupled from the actual Annotation
instances so multiple annotation instances can point to the same content
without causing any overhead in storage. Moreover, it facilitates indexing and
searching. The annotation data is part of an AnnotationDataSet, which
effectively defines a certain user-defined vocabulary.
Once instantiated, instances of this type are, by design, largely immutable. The key and value can not be changed. Create a new AnnotationData and new Annotation for edits.
Implementations§
source§impl AnnotationData
impl AnnotationData
sourcepub fn new(id: Option<String>, key: DataKeyHandle, value: DataValue) -> Self
pub fn new(id: Option<String>, key: DataKeyHandle, value: DataValue) -> Self
Creates a new unbounded AnnotationData instance, you will likely never want to instantiate this directly, but via
sourcepub fn builder<'a>() -> AnnotationDataBuilder<'a>
pub fn builder<'a>() -> AnnotationDataBuilder<'a>
Returns an Annotation data builder to build new annotationdata
pub fn key(&self) -> DataKeyHandle
sourcepub fn value(&self) -> &DataValue
pub fn value(&self) -> &DataValue
Get the value of this annotationdata. The value will be a DataValue instance. This will return an immutable reference. Note that there is no mutable variant nor a set_value(), values can deliberately only be set once at instantiation. Make a new AnnotationData if you want to change data.
Trait Implementations§
source§impl Clone for AnnotationData
impl Clone for AnnotationData
source§fn clone(&self) -> AnnotationData
fn clone(&self) -> AnnotationData
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for AnnotationData
impl Debug for AnnotationData
source§impl PartialEq<AnnotationData> for AnnotationData
impl PartialEq<AnnotationData> for AnnotationData
source§fn eq(&self, other: &AnnotationData) -> bool
fn eq(&self, other: &AnnotationData) -> bool
self and other values to be equal, and is used
by ==.source§impl Storable for AnnotationData
impl Storable for AnnotationData
type HandleType = AnnotationDataHandle
type StoreType = AnnotationDataSet
source§fn handle(&self) -> Option<AnnotationDataHandle>
fn handle(&self) -> Option<AnnotationDataHandle>
StoreFor<T>, this may be None only in the initial
stage when it is still unbounded to a store.source§fn set_handle(&mut self, intid: AnnotationDataHandle)
fn set_handle(&mut self, intid: AnnotationDataHandle)
source§fn carries_id() -> bool
fn carries_id() -> bool
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 id_or_err(&self) -> Result<&str, StamError>
fn id_or_err(&self) -> Result<&str, StamError>
Self::id() but returns a StamError::NoIdError error if there is no internal id.source§fn wrap_in<'store>(
&'store self,
store: &'store Self::StoreType
) -> Result<WrappedItem<'store, Self>, StamError>where
Self: Sized,
fn wrap_in<'store>( &'store self, store: &'store Self::StoreType ) -> Result<WrappedItem<'store, Self>, StamError>where Self: Sized,
StoreFor<T>::wrap()source§fn wrap_owned_in<'store>(
self,
store: &'store Self::StoreType
) -> Result<WrappedItem<'store, Self>, StamError>where
Self: Sized,
fn wrap_owned_in<'store>( self, store: &'store Self::StoreType ) -> Result<WrappedItem<'store, Self>, StamError>where Self: Sized,
StoreFor<T>::wrap_owned()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<AnnotationData> for AnnotationDataSet
impl StoreFor<AnnotationData> for AnnotationDataSet
source§fn preremove(&mut self, handle: AnnotationDataHandle) -> Result<(), StamError>
fn preremove(&mut self, handle: AnnotationDataHandle) -> Result<(), StamError>
called before the item is removed from the store updates the relation maps, no need to call manually