From 8038e7ed943c45c82d668cc1e4c9e9426d68112e Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Sun, 22 Sep 2024 16:19:38 +0200 Subject: [PATCH] renamed AnnotationStore.add() to AnnotationStore.with_item() and fixed some last examples --- src/store.rs | 4 ++-- tests/common/mod.rs | 22 +++++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/store.rs b/src/store.rs index 81c2f76..69880c4 100644 --- a/src/store.rs +++ b/src/store.rs @@ -796,8 +796,8 @@ pub trait StoreFor: Configurable + private::StoreCallbacks { Ok(handle) } - /// Inserts items into the store using a builder pattern - fn add(mut self, item: T) -> Result + /// Inserts items into the store using a builder pattern. + fn with_item(mut self, item: T) -> Result where Self: Sized, { diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 266e082..86e8bdf 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -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 { 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 { 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()