Skip to content

Commit

Permalink
renamed AnnotationStore.add() to AnnotationStore.with_item() and fixe…
Browse files Browse the repository at this point in the history
…d some last examples
  • Loading branch information
proycon committed Sep 22, 2024
1 parent 646aef5 commit 8038e7e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,8 +796,8 @@ pub trait StoreFor<T: Storable>: Configurable + private::StoreCallbacks<T> {
Ok(handle)
}

/// Inserts items into the store using a builder pattern
fn add(mut self, item: T) -> Result<Self, StamError>
/// Inserts items into the store using a builder pattern.
fn with_item(mut self, item: T) -> Result<Self, StamError>
where
Self: Sized,
{
Expand Down
22 changes: 11 additions & 11 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,23 @@ No one shall be held in slavery or servitude; slavery and the slave trade shall
pub fn setup_example_5() -> Result<AnnotationStore, StamError> {
let store = AnnotationStore::default()
.with_id("example5")
.add(TextResource::from_string(
"humanrights",
EXAMPLE5_TEXT,
Config::default(),
))?
.add(AnnotationDataSet::new(Config::default()).with_id("testdataset"))?;
.with_resource(
TextResourceBuilder::new()
.with_id("humanrights")
.with_text(EXAMPLE5_TEXT),
)?
.with_dataset(AnnotationDataSetBuilder::new().with_id("testdataset"))?;
Ok(store)
}

pub fn setup_example_6() -> Result<AnnotationStore, StamError> {
let store = AnnotationStore::default()
.with_id("example6")
.add(TextResource::from_string(
"humanrights",
"All human beings are born free and equal in dignity and rights.",
Config::default(),
))?
.with_resource(
TextResourceBuilder::new()
.with_id("humanrights")
.with_text("All human beings are born free and equal in dignity and rights."),
)?
.with_dataset(AnnotationDataSetBuilder::new().with_id("testdataset"))?
.with_annotation(
AnnotationBuilder::new()
Expand Down

0 comments on commit 8038e7e

Please sign in to comment.