Struct stam::AnnotationStore
source · pub struct AnnotationStore { /* private fields */ }Expand description
An Annotation Store is an unordered collection of annotations, resources and annotation data sets. It can be seen as the root of the graph model and the glue that holds everything together. It is the entry point for any stam model.
Implementations§
source§impl AnnotationStore
impl AnnotationStore
sourcepub fn with_annotation(
self,
builder: AnnotationBuilder<'_>
) -> Result<Self, StamError>
pub fn with_annotation( self, builder: AnnotationBuilder<'_> ) -> Result<Self, StamError>
Builds and adds an annotation
sourcepub fn with_annotations(
self,
builders: Vec<AnnotationBuilder<'_>>
) -> Result<Self, StamError>
pub fn with_annotations( self, builders: Vec<AnnotationBuilder<'_>> ) -> Result<Self, StamError>
Builds and adds multiple annotations
sourcepub fn insert_data(
&mut self,
dataitem: AnnotationDataBuilder<'_>
) -> Result<(AnnotationDataSetHandle, AnnotationDataHandle), StamError>
pub fn insert_data( &mut self, dataitem: AnnotationDataBuilder<'_> ) -> Result<(AnnotationDataSetHandle, AnnotationDataHandle), StamError>
Builds and inserts an AnnotationData item
sourcepub fn annotate(
&mut self,
builder: AnnotationBuilder<'_>
) -> Result<AnnotationHandle, StamError>
pub fn annotate( &mut self, builder: AnnotationBuilder<'_> ) -> Result<AnnotationHandle, StamError>
Builds and inserts an annotation
In a builder pattenr, use [Self.with_annotation()] instead
sourcepub fn annotate_builders(
&mut self,
builders: Vec<AnnotationBuilder<'_>>
) -> Result<(), StamError>
pub fn annotate_builders( &mut self, builders: Vec<AnnotationBuilder<'_>> ) -> Result<(), StamError>
Builds and inserts using multiple annotation builders
source§impl AnnotationStore
impl AnnotationStore
sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new empty annotation store with a default configuraton, add the [AnnotationStore.with_config()] to provide a custom one
sourcepub fn from_file(filename: &str, config: Config) -> Result<Self, StamError>
pub fn from_file(filename: &str, config: Config) -> Result<Self, StamError>
Loads an AnnotationStore from a file (STAM JSON or another supported format) The file must contain a single object which has “@type”: “AnnotationStore”
sourcepub fn from_str(string: &str, config: Config) -> Result<Self, StamError>
pub fn from_str(string: &str, config: Config) -> Result<Self, StamError>
Loads an AnnotationStore from a STAM JSON string The string must contain a single object which has “@type”: “AnnotationStore”
sourcepub fn with_file(self, filename: &str) -> Result<Self, StamError>
pub fn with_file(self, filename: &str) -> Result<Self, StamError>
Merge another annotation store STAM JSON file into this one
sourcepub fn annotations_filename(&self) -> Option<&Path>
pub fn annotations_filename(&self) -> Option<&Path>
Returns the filename associated with this annotation store for storage of annotations Only used for STAM CSV, not for STAM JSON.
sourcepub fn annotate_from_file(
&mut self,
filename: &str
) -> Result<&mut Self, StamError>
pub fn annotate_from_file( &mut self, filename: &str ) -> Result<&mut Self, StamError>
Load a JSON file containing an array of annotations in STAM JSON
sourcepub fn to_file(&mut self, filename: &str) -> Result<(), StamError>
pub fn to_file(&mut self, filename: &str) -> Result<(), StamError>
Write the annotation store and all files below it to file (STAM JSON or other supported formats likes STAM CSV) The filetype is determined by the extension.
sourcepub fn merge_from_builder(
&mut self,
builder: AnnotationStoreBuilder<'_>
) -> Result<&mut Self, StamError>
pub fn merge_from_builder( &mut self, builder: AnnotationStoreBuilder<'_> ) -> Result<&mut Self, StamError>
Merge another annotation store, represented by a builder, into this one
It’s a fairly low-level function which you often don’t need directly, use AnnotationStore.with_file() instead.
sourcepub fn save(&self) -> Result<(), StamError>
pub fn save(&self) -> Result<(), StamError>
Shortcut to write an AnnotationStore to a STAM JSON file, writes to the same file as was loaded.
Returns an error if no filename was associated yet.
Use [AnnotationStore.to_file] instead if you want to write elsewhere.
sourcepub fn with_id(self, id: String) -> Self
pub fn with_id(self, id: String) -> Self
Sets the ID of the annotation store in a builder pattern
sourcepub fn add_resource_from_file(
&mut self,
filename: &str
) -> Result<TextResourceHandle, StamError>
pub fn add_resource_from_file( &mut self, filename: &str ) -> Result<TextResourceHandle, StamError>
Shortcut method that calls add_resource under the hood and returns a reference to it
sourcepub fn resolve_annotation_id(
&self,
id: &str
) -> Result<AnnotationHandle, StamError>
pub fn resolve_annotation_id( &self, id: &str ) -> Result<AnnotationHandle, StamError>
Get an annotation handle from an ID. Shortcut wraps arround get_handle()
sourcepub fn resolve_dataset_id(
&self,
id: &str
) -> Result<AnnotationDataSetHandle, StamError>
pub fn resolve_dataset_id( &self, id: &str ) -> Result<AnnotationDataSetHandle, StamError>
Get an annotation dataset handle from an ID. Shortcut wraps arround get_handle()
sourcepub fn resolve_resource_id(
&self,
id: &str
) -> Result<TextResourceHandle, StamError>
pub fn resolve_resource_id( &self, id: &str ) -> Result<TextResourceHandle, StamError>
Get an annotation dataset handle from an ID. Shortcut wraps arround get_handle()
sourcepub fn annotations<'a>(&'a self) -> StoreIter<'a, Annotation> ⓘ
pub fn annotations<'a>(&'a self) -> StoreIter<'a, Annotation> ⓘ
Returns an iterator over all annotations (Annotation) in the store
sourcepub fn resources<'a>(&'a self) -> StoreIter<'a, TextResource> ⓘ
pub fn resources<'a>(&'a self) -> StoreIter<'a, TextResource> ⓘ
Returns an iterator over all text resources (TextResource instances) in the store
sourcepub fn annotationsets<'a>(&'a self) -> StoreIter<'a, AnnotationDataSet> ⓘ
pub fn annotationsets<'a>(&'a self) -> StoreIter<'a, AnnotationDataSet> ⓘ
Returns an iterator over all AnnotationDataSet instances in the store
sourcepub fn annotations_len(&self) -> usize
pub fn annotations_len(&self) -> usize
Returns the number of annotations in the store (deletions are not substracted)
sourcepub fn resources_len(&self) -> usize
pub fn resources_len(&self) -> usize
Returns the number of resources in the store (deletions are not substracted)
sourcepub fn annotationsets_len(&self) -> usize
pub fn annotationsets_len(&self) -> usize
Returns the number of datasets in the store (deletions are not substracted)
sourcepub fn annotations_by_resource(
&self,
resource_handle: TextResourceHandle
) -> Option<impl Iterator<Item = AnnotationHandle> + '_>
pub fn annotations_by_resource( &self, resource_handle: TextResourceHandle ) -> Option<impl Iterator<Item = AnnotationHandle> + '_>
Returns all annotations that reference any text selection in the resource.
This is a low-level method, use [WrappedItem<TextResource>.annotations()] instead for higher-level access.
Use [Self.annotations_by_resource_metadata()] instead if you are looking for annotations that reference the resource as is
sourcepub fn annotations_by_resource_metadata(
&self,
resource_handle: TextResourceHandle
) -> Option<&Vec<AnnotationHandle>>
pub fn annotations_by_resource_metadata( &self, resource_handle: TextResourceHandle ) -> Option<&Vec<AnnotationHandle>>
This only returns annotations that directly point at the resource, i.e. are metadata for it. It does not include annotations that
This is a low-level method, use [WrappedItem<TextResource>.annotations(_metadata] instead for higher-level access.
point at a text in the resource, use [Self.annotations_by_resource()] instead for those.
sourcepub fn annotations_by_textselection(
&self,
resource_handle: TextResourceHandle,
textselection: &TextSelection
) -> Option<&Vec<AnnotationHandle>>
pub fn annotations_by_textselection( &self, resource_handle: TextResourceHandle, textselection: &TextSelection ) -> Option<&Vec<AnnotationHandle>>
Find all annotations with a particular textselection. This is a quick lookup in the reverse index and returns a reference to a vector.
This is a low-level method, use [WrappedItem<TextSelection>.annotations()] instead for higher-level access.
sourcepub fn annotations_by_offset<'a>(
&'a self,
resource_handle: TextResourceHandle,
offset: &Offset
) -> Option<&'a Vec<AnnotationHandle>>
pub fn annotations_by_offset<'a>( &'a self, resource_handle: TextResourceHandle, offset: &Offset ) -> Option<&'a Vec<AnnotationHandle>>
Find all annotations with a particular offset (exact). This is a lookup in the reverse index and returns a reference to a vector. This is a low-level method.
sourcepub fn annotations_by_annotation_reverse(
&self,
annotation_handle: AnnotationHandle
) -> Option<&Vec<AnnotationHandle>>
pub fn annotations_by_annotation_reverse( &self, annotation_handle: AnnotationHandle ) -> Option<&Vec<AnnotationHandle>>
Find all annotations that overlap with a particular offset. Find all annotations referenced by the specified annotation (i.e. annotations that point AT the specified annotation). This is a lookup in the reverse index and returns a reference to a vector
This is a low-lever function, use [WrappedItem<Annotation>.annotations_reverse()] instead.
Use [wrappeditem<annotation>.annotations()] if you are looking for the annotations that an annotation points at.
sourcepub fn annotations_by_annotationset(
&self,
annotationset_handle: AnnotationDataSetHandle
) -> Option<impl Iterator<Item = AnnotationHandle> + '_>
pub fn annotations_by_annotationset( &self, annotationset_handle: AnnotationDataSetHandle ) -> Option<impl Iterator<Item = AnnotationHandle> + '_>
Returns all annotations that reference any keys/data in an annotationset
Use [Self.annotations_by_annotationset_metadata()] instead if you are looking for annotations that reference the dataset as is
This is a low-level method. Use [WrappedItem<AnnotationDataSet>.annotations()] instead.
sourcepub fn annotations_by_annotationset_metadata(
&self,
annotationset_handle: AnnotationDataSetHandle
) -> Option<&Vec<AnnotationHandle>>
pub fn annotations_by_annotationset_metadata( &self, annotationset_handle: AnnotationDataSetHandle ) -> Option<&Vec<AnnotationHandle>>
Find all annotations referenced by the specified annotationset. This is a lookup in the reverse index and returns a reference to a vector.
This only returns annotations that directly point at the dataset, i.e. are metadata for it.
This is a low-level method. Use [WrappedItem<AnnotationDataSet>.annotations_metadata()] instead.
sourcepub fn annotations_by_data(
&self,
annotationset_handle: AnnotationDataSetHandle,
data_handle: AnnotationDataHandle
) -> Option<&Vec<AnnotationHandle>>
pub fn annotations_by_data( &self, annotationset_handle: AnnotationDataSetHandle, data_handle: AnnotationDataHandle ) -> Option<&Vec<AnnotationHandle>>
Find all annotations referenced by data. This is a lookup in the reverse index and return a reference.
This is a low-level method. Use [WrappedItem<AnnotationData>.annotations()] instead.
sourcepub fn annotations_by_key(
&self,
annotationset_handle: AnnotationDataSetHandle,
datakey_handle: DataKeyHandle
) -> Option<impl Iterator<Item = AnnotationHandle> + '_>
pub fn annotations_by_key( &self, annotationset_handle: AnnotationDataSetHandle, datakey_handle: DataKeyHandle ) -> Option<impl Iterator<Item = AnnotationHandle> + '_>
Find all annotations referenced by key This is a low-level method
sourcepub fn textselection<'b>(
&self,
selector: &Selector,
subselectors: Option<impl Iterator<Item = &'b Selector>>
) -> Result<WrappedItem<'_, TextSelection>, StamError>
pub fn textselection<'b>( &self, selector: &Selector, subselectors: Option<impl Iterator<Item = &'b Selector>> ) -> Result<WrappedItem<'_, TextSelection>, StamError>
Retrieve a TextSelection given a specific TextSelector. Does not work with other more
complex selectors, use for instance [AnnotationStore::textselections_by_annotation]
instead for those.
If multiple AnnotationSelectors are involved, they can be passed as subselectors
and will further refine the TextSelection, but this is usually not invoked directly but via [AnnotationStore::textselections_by_annotation]
sourcepub fn selector(
&mut self,
item: SelectorBuilder<'_>
) -> Result<Selector, StamError>
pub fn selector( &mut self, item: SelectorBuilder<'_> ) -> Result<Selector, StamError>
Builds a Selector based on its SelectorBuilder, this will produce an error if the selected resource does not exist.
sourcepub fn annotation(
&self,
annotation: &Item<'_, Annotation>
) -> Option<WrappedItem<'_, Annotation>>
pub fn annotation( &self, annotation: &Item<'_, Annotation> ) -> Option<WrappedItem<'_, Annotation>>
Method to retrieve an annotation from the store.
Returns a reference to Annotation that is wrapped in a fat pointer (WrappedItem<Annotation>) that also contains reference to the store
and which is immediately implements various methods for working with the type.
If you need a more performant low-level method, use StoreFor<T>::get() instead.
sourcepub fn annotationset(
&self,
annotationset: &Item<'_, AnnotationDataSet>
) -> Option<WrappedItem<'_, AnnotationDataSet>>
pub fn annotationset( &self, annotationset: &Item<'_, AnnotationDataSet> ) -> Option<WrappedItem<'_, AnnotationDataSet>>
Get an [AnnotationDataSet'] by reference (as a fat pointer [WrappedItem<AnnotationDataSet’])
Returns None if it does not exist.
sourcepub fn resource(
&self,
resource: &Item<'_, TextResource>
) -> Option<WrappedItem<'_, TextResource>>
pub fn resource( &self, resource: &Item<'_, TextResource> ) -> Option<WrappedItem<'_, TextResource>>
Get a [TextResource'] by reference (as a fat pointer [WrappedItem<TextResource’])
Returns None if it does not exist.
source§impl AnnotationStore
impl AnnotationStore
sourcepub fn find_text_regex<'store, 'r>(
&'store self,
expressions: &'r [Regex],
precompiledset: &'r Option<RegexSet>,
allow_overlap: bool
) -> impl Iterator<Item = FindRegexMatch<'store, 'r>>
pub fn find_text_regex<'store, 'r>( &'store self, expressions: &'r [Regex], precompiledset: &'r Option<RegexSet>, allow_overlap: bool ) -> impl Iterator<Item = FindRegexMatch<'store, 'r>>
Searches for text in all resources using one or more regular expressions, returns an iterator over TextSelections along with the matching expression, this
See [TextResource.find_text_regex()].
Note that this method, unlike its counterpart [TextResource.find_text_regex()], silently ignores any deeper errors that might occur.
source§impl AnnotationStore
impl AnnotationStore
sourcepub fn to_csv_files(&self, filename: &str) -> Result<(), StamError>
pub fn to_csv_files(&self, filename: &str) -> Result<(), StamError>
Saves all files as CSV. It is better to use AnnotationStore::save() instead, setting
[AnnotationStore::set_dataformat(DataFormat::Csv)] before invocation.
Trait Implementations§
source§impl AssociatedFile for AnnotationStore
impl AssociatedFile for AnnotationStore
fn with_filename(self, filename: &str) -> Self
fn set_filename(&mut self, filename: &str) -> &mut Self
source§fn filename_without_extension(&self) -> Option<&str>
fn filename_without_extension(&self) -> Option<&str>
source§fn filename_without_workdir(&self) -> Option<&str>
fn filename_without_workdir(&self) -> Option<&str>
source§impl Configurable for AnnotationStore
impl Configurable for AnnotationStore
source§fn set_config(&mut self, config: Config) -> &mut Self
fn set_config(&mut self, config: Config) -> &mut Self
Sets the configuration, this will also overwrite all underlying configurations for annotation data sets and resources!
fn config_mut(&mut self) -> &mut Config
source§fn with_config(self, config: Config) -> Self
fn with_config(self, config: Config) -> Self
source§impl Debug for AnnotationStore
impl Debug for AnnotationStore
source§impl Default for AnnotationStore
impl Default for AnnotationStore
source§impl<'de> Deserialize<'de> for AnnotationStore
impl<'de> Deserialize<'de> for AnnotationStore
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>,
source§impl Serialize for AnnotationStore
impl Serialize for AnnotationStore
source§impl StoreFor<Annotation> for AnnotationStore
impl StoreFor<Annotation> for AnnotationStore
source§fn preremove(&mut self, handle: AnnotationHandle) -> Result<(), StamError>
fn preremove(&mut self, handle: AnnotationHandle) -> Result<(), StamError>
called before the item is removed from the store updates the relation maps, no need to call manually
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 inserted(&mut self, handle: AnnotationHandle) -> Result<(), StamError>
fn inserted(&mut self, handle: AnnotationHandle) -> Result<(), StamError>
source§fn insert(&mut self, item: T) -> Result<T::HandleType, StamError>
fn insert(&mut self, item: T) -> Result<T::HandleType, StamError>
source§fn preinsert(&self, item: &mut T) -> Result<(), StamError>
fn preinsert(&self, item: &mut T) -> Result<(), StamError>
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<'a, 'b>(&'a self, item: &Item<'b, T>) -> Result<&'a T, StamError>
fn get<'a, 'b>(&'a self, item: &Item<'b, T>) -> Result<&'a T, StamError>
source§fn get_mut<'a, 'b>(&mut self, item: &Item<'b, T>) -> Result<&mut T, StamError>
fn get_mut<'a, 'b>(&mut self, item: &Item<'b, 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 owns(&self, item: &T) -> Option<bool>
fn owns(&self, item: &T) -> Option<bool>
source§fn iter<'a>(&'a self) -> StoreIter<'a, T> ⓘwhere
T: Storable<StoreType = Self>,
fn iter<'a>(&'a self) -> StoreIter<'a, T> ⓘwhere T: Storable<StoreType = Self>,
source§fn iter_mut<'a>(&'a mut self) -> StoreIterMut<'a, T> ⓘ
fn iter_mut<'a>(&'a mut self) -> StoreIterMut<'a, T> ⓘ
source§fn next_handle(&self) -> T::HandleType
fn next_handle(&self) -> T::HandleType
source§fn last_handle(&self) -> T::HandleType
fn last_handle(&self) -> T::HandleType
source§fn bind(&mut self, item: T) -> Result<T, StamError>
fn bind(&mut self, item: T) -> Result<T, StamError>
source§fn wrap<'a>(&'a self, item: &'a T) -> Result<WrappedItem<'_, T>, StamError>where
T: Storable<StoreType = Self>,
fn wrap<'a>(&'a self, item: &'a T) -> Result<WrappedItem<'_, T>, StamError>where T: Storable<StoreType = Self>,
source§fn wrap_owned<'a>(&'a self, item: T) -> Result<WrappedItem<'_, T>, StamError>where
T: Storable<StoreType = Self>,
fn wrap_owned<'a>(&'a self, item: T) -> Result<WrappedItem<'_, T>, StamError>where T: Storable<StoreType = Self>,
source§fn wrap_store<'a>(&'a self) -> WrappedStore<'_, T, Self>where
Self: Sized,
fn wrap_store<'a>(&'a self) -> WrappedStore<'_, T, Self>where Self: Sized,
source§impl StoreFor<AnnotationDataSet> for AnnotationStore
impl StoreFor<AnnotationDataSet> for AnnotationStore
source§fn preinsert(&self, item: &mut AnnotationDataSet) -> Result<(), StamError>
fn preinsert(&self, item: &mut AnnotationDataSet) -> Result<(), StamError>
Called prior to inserting an item into to the store If it returns an error, the insert will be cancelled. Allows for bookkeeping such as inheriting configuration parameters from parent to the item
source§fn preremove(
&mut self,
handle: AnnotationDataSetHandle
) -> Result<(), StamError>
fn preremove( &mut self, handle: AnnotationDataSetHandle ) -> Result<(), StamError>
called before the item is removed from the store updates the relation maps, no need to call manually
source§fn store(&self) -> &Store<AnnotationDataSet>
fn store(&self) -> &Store<AnnotationDataSet>
source§fn store_mut(&mut self) -> &mut Store<AnnotationDataSet>
fn store_mut(&mut self) -> &mut Store<AnnotationDataSet>
source§fn idmap(&self) -> Option<&IdMap<AnnotationDataSetHandle>>
fn idmap(&self) -> Option<&IdMap<AnnotationDataSetHandle>>
source§fn idmap_mut(&mut self) -> Option<&mut IdMap<AnnotationDataSetHandle>>
fn idmap_mut(&mut self) -> Option<&mut IdMap<AnnotationDataSetHandle>>
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 inserted(&mut self, handle: T::HandleType) -> Result<(), StamError>
fn inserted(&mut self, handle: T::HandleType) -> Result<(), StamError>
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<'a, 'b>(&'a self, item: &Item<'b, T>) -> Result<&'a T, StamError>
fn get<'a, 'b>(&'a self, item: &Item<'b, T>) -> Result<&'a T, StamError>
source§fn get_mut<'a, 'b>(&mut self, item: &Item<'b, T>) -> Result<&mut T, StamError>
fn get_mut<'a, 'b>(&mut self, item: &Item<'b, 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 owns(&self, item: &T) -> Option<bool>
fn owns(&self, item: &T) -> Option<bool>
source§fn iter<'a>(&'a self) -> StoreIter<'a, T> ⓘwhere
T: Storable<StoreType = Self>,
fn iter<'a>(&'a self) -> StoreIter<'a, T> ⓘwhere T: Storable<StoreType = Self>,
source§fn iter_mut<'a>(&'a mut self) -> StoreIterMut<'a, T> ⓘ
fn iter_mut<'a>(&'a mut self) -> StoreIterMut<'a, T> ⓘ
source§fn next_handle(&self) -> T::HandleType
fn next_handle(&self) -> T::HandleType
source§fn last_handle(&self) -> T::HandleType
fn last_handle(&self) -> T::HandleType
source§fn bind(&mut self, item: T) -> Result<T, StamError>
fn bind(&mut self, item: T) -> Result<T, StamError>
source§fn wrap<'a>(&'a self, item: &'a T) -> Result<WrappedItem<'_, T>, StamError>where
T: Storable<StoreType = Self>,
fn wrap<'a>(&'a self, item: &'a T) -> Result<WrappedItem<'_, T>, StamError>where T: Storable<StoreType = Self>,
source§fn wrap_owned<'a>(&'a self, item: T) -> Result<WrappedItem<'_, T>, StamError>where
T: Storable<StoreType = Self>,
fn wrap_owned<'a>(&'a self, item: T) -> Result<WrappedItem<'_, T>, StamError>where T: Storable<StoreType = Self>,
source§fn wrap_store<'a>(&'a self) -> WrappedStore<'_, T, Self>where
Self: Sized,
fn wrap_store<'a>(&'a self) -> WrappedStore<'_, T, Self>where Self: Sized,
source§impl StoreFor<TextResource> for AnnotationStore
impl StoreFor<TextResource> for AnnotationStore
source§fn store(&self) -> &Store<TextResource>
fn store(&self) -> &Store<TextResource>
Get a reference to the entire store for the associated type
source§fn store_mut(&mut self) -> &mut Store<TextResource>
fn store_mut(&mut self) -> &mut Store<TextResource>
Get a mutable reference to the entire store for the associated type
source§fn idmap(&self) -> Option<&IdMap<TextResourceHandle>>
fn idmap(&self) -> Option<&IdMap<TextResourceHandle>>
Get a reference to the id map for the associated type, mapping global ids to internal ids
source§fn idmap_mut(&mut self) -> Option<&mut IdMap<TextResourceHandle>>
fn idmap_mut(&mut self) -> Option<&mut IdMap<TextResourceHandle>>
Get a mutable reference to the id map for the associated type, mapping global ids to internal ids
source§fn preinsert(&self, item: &mut TextResource) -> Result<(), StamError>
fn preinsert(&self, item: &mut TextResource) -> Result<(), StamError>
Called prior to inserting an item into to the store If it returns an error, the insert will be cancelled. Allows for bookkeeping such as inheriting configuration parameters from parent to the item
source§fn preremove(&mut self, handle: TextResourceHandle) -> Result<(), StamError>
fn preremove(&mut self, handle: TextResourceHandle) -> Result<(), StamError>
called before the item is removed from the store updates the relation maps, no need to call manually
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 inserted(&mut self, handle: T::HandleType) -> Result<(), StamError>
fn inserted(&mut self, handle: T::HandleType) -> Result<(), StamError>
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<'a, 'b>(&'a self, item: &Item<'b, T>) -> Result<&'a T, StamError>
fn get<'a, 'b>(&'a self, item: &Item<'b, T>) -> Result<&'a T, StamError>
source§fn get_mut<'a, 'b>(&mut self, item: &Item<'b, T>) -> Result<&mut T, StamError>
fn get_mut<'a, 'b>(&mut self, item: &Item<'b, 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 owns(&self, item: &T) -> Option<bool>
fn owns(&self, item: &T) -> Option<bool>
source§fn iter<'a>(&'a self) -> StoreIter<'a, T> ⓘwhere
T: Storable<StoreType = Self>,
fn iter<'a>(&'a self) -> StoreIter<'a, T> ⓘwhere T: Storable<StoreType = Self>,
source§fn iter_mut<'a>(&'a mut self) -> StoreIterMut<'a, T> ⓘ
fn iter_mut<'a>(&'a mut self) -> StoreIterMut<'a, T> ⓘ
source§fn next_handle(&self) -> T::HandleType
fn next_handle(&self) -> T::HandleType
source§fn last_handle(&self) -> T::HandleType
fn last_handle(&self) -> T::HandleType
source§fn bind(&mut self, item: T) -> Result<T, StamError>
fn bind(&mut self, item: T) -> Result<T, StamError>
source§fn wrap<'a>(&'a self, item: &'a T) -> Result<WrappedItem<'_, T>, StamError>where
T: Storable<StoreType = Self>,
fn wrap<'a>(&'a self, item: &'a T) -> Result<WrappedItem<'_, T>, StamError>where T: Storable<StoreType = Self>,
source§fn wrap_owned<'a>(&'a self, item: T) -> Result<WrappedItem<'_, T>, StamError>where
T: Storable<StoreType = Self>,
fn wrap_owned<'a>(&'a self, item: T) -> Result<WrappedItem<'_, T>, StamError>where T: Storable<StoreType = Self>,
source§fn wrap_store<'a>(&'a self) -> WrappedStore<'_, T, Self>where
Self: Sized,
fn wrap_store<'a>(&'a self) -> WrappedStore<'_, T, Self>where Self: Sized,
source§impl ToCsv for AnnotationStorewhere
Self: TypeInfo + Configurable,
impl ToCsv for AnnotationStorewhere Self: TypeInfo + Configurable,
source§fn to_csv_writer<W>(&self, writer: W, table: CsvTable) -> Result<(), StamError>where
W: Write,
fn to_csv_writer<W>(&self, writer: W, table: CsvTable) -> Result<(), StamError>where W: Write,
Writes CSV output, for the specified table, to the writer
source§fn to_csv_file(
&self,
filename: &str,
config: &Config,
table: CsvTable
) -> Result<(), StamError>
fn to_csv_file( &self, filename: &str, config: &Config, table: CsvTable ) -> Result<(), StamError>
config, the default is STAM JSON.
Note: This only writes a single table! Just use [AnnotationStore.save()] to write everything.