Struct stam::AnnotationDataSetBuilder
source · pub struct AnnotationDataSetBuilder<'a> { /* private fields */ }Implementations§
source§impl<'a> AnnotationDataSetBuilder<'a>
impl<'a> AnnotationDataSetBuilder<'a>
sourcepub fn new() -> Self
pub fn new() -> Self
Start a new builder to build an AnnotationDataSet. You can chain various with_* methods and subsequently call build() to produce the actual AnnotationDataSet.
sourcepub fn from_file(filename: &str, config: Config) -> Result<Self, StamError>
pub fn from_file(filename: &str, config: Config) -> Result<Self, StamError>
Loads an AnnotationDataSetBuilder from file (STAM JSON or other supported format). For STAM JSON, the file must contain a single object which has “@type”: “AnnotationDataSet”
sourcepub fn with_id(self, id: String) -> Self
pub fn with_id(self, id: String) -> Self
Set the public ID for the AnnotationDataSet that will be built.
sourcepub fn with_keys(self, keys: Vec<DataKey>) -> Self
pub fn with_keys(self, keys: Vec<DataKey>) -> Self
Adds multiple keys at once. This can only be called once (it will override any prior set keys)
sourcepub fn with_key(self, key: DataKey) -> Self
pub fn with_key(self, key: DataKey) -> Self
Adds a data key. This can be called multiple times.
sourcepub fn with_data_builders(self, data: Vec<AnnotationDataBuilder<'a>>) -> Self
pub fn with_data_builders(self, data: Vec<AnnotationDataBuilder<'a>>) -> Self
Adds multiple data builder at once. This can only be called once (it will override any prior set keys)
sourcepub fn with_data(self, data: AnnotationDataBuilder<'a>) -> Self
pub fn with_data(self, data: AnnotationDataBuilder<'a>) -> Self
Adds a data builder. This can be called multiple times.
sourcepub fn with_filename(self, filename: &str) -> Self
pub fn with_filename(self, filename: &str) -> Self
Set the filename for the AnnotationDataSet that will be built. This does not load from file. Use AnnotationDataSet::from_file() instead of this builder if that’s what you want.
pub fn with_config(self, config: Config) -> Self
sourcepub fn build(self) -> Result<AnnotationDataSet, StamError>
pub fn build(self) -> Result<AnnotationDataSet, StamError>
Final builder method, constructs the [’AnnotationDataSet`], consuming the builder
Trait Implementations§
source§impl<'a> Default for AnnotationDataSetBuilder<'a>
impl<'a> Default for AnnotationDataSetBuilder<'a>
source§fn default() -> AnnotationDataSetBuilder<'a>
fn default() -> AnnotationDataSetBuilder<'a>
source§impl<'de, 'a> Deserialize<'de> for AnnotationDataSetBuilder<'a>
impl<'de, 'a> Deserialize<'de> for AnnotationDataSetBuilder<'a>
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<'c, 'a> FromCsv<'c> for AnnotationDataSetBuilder<'a>
impl<'c, 'a> FromCsv<'c> for AnnotationDataSetBuilder<'a>
source§impl<'j, 'a> FromJson<'j> for AnnotationDataSetBuilder<'a>
impl<'j, 'a> FromJson<'j> for AnnotationDataSetBuilder<'a>
source§fn from_json_file(filename: &str, config: Config) -> Result<Self, StamError>
fn from_json_file(filename: &str, config: Config) -> Result<Self, StamError>
Loads an AnnotationDataSet from a STAM JSON file, as a builder
The file must contain a single object which has “@type”: “AnnotationDataSet”
If include is true, the file will be included via the @include mechanism, and is kept external upon serialization
If workdir is set, the file will be searched for in the workdir if needed