pub struct EntryBuilder { /* private fields */ }
Expand description
Builder Pattern for creating new Entry items to be inserted into a Table
Implementations§
Source§impl EntryBuilder
impl EntryBuilder
Sourcepub fn set_primary_field(self, field: Field) -> Result<Self, DatabaseError>
pub fn set_primary_field(self, field: Field) -> Result<Self, DatabaseError>
Sets the primary_field of the Entry
use persistent_keystore_rs::{Entry, Field};
let mut entry_builder = Entry::new()
.set_primary_field(Field::String("MyFirstEntry".to_string())).unwrap();
Sourcepub fn add_field(self, key: String, field: Field) -> Result<Self, DatabaseError>
pub fn add_field(self, key: String, field: Field) -> Result<Self, DatabaseError>
Add a field to the Entry. This can include both required and optional fields.
use persistent_keystore_rs::{Entry, Field};
let mut entry_builder = Entry::new()
.set_primary_field(Field::String("MyFirstEntry".to_string())).unwrap()
.add_field("Count".to_string(), Field::I32(0)).unwrap();
Sourcepub fn build(self) -> Result<Entry, DatabaseError>
pub fn build(self) -> Result<Entry, DatabaseError>
Validates the Entry is properly formatted with a primary field and contains at least one value field.
use persistent_keystore_rs::{Entry, Field};
let entry = Entry::new()
.set_primary_field(Field::String("MyFirstEntry".to_string())).unwrap()
.add_field("Count".to_string(), Field::I32(3)).unwrap()
.build().unwrap();
Auto Trait Implementations§
impl Freeze for EntryBuilder
impl RefUnwindSafe for EntryBuilder
impl Send for EntryBuilder
impl Sync for EntryBuilder
impl Unpin for EntryBuilder
impl UnwindSafe for EntryBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more