Struct persistent_keystore_rs::TableBuilder [−][src]
pub struct TableBuilder { /* fields omitted */ }
Expand description
Builder Pattern for creating a new Table
Implementations
Sets the Name of the Table
use persistent_keystore_rs::Table;
let table = Table::new()
.name("MyTable".to_string());
Sets the FieldType of the primary_field
use persistent_keystore_rs::{Table, FieldType};
let table = Table::new()
.primary_field(FieldType::String).unwrap();
Add a required field of FieldType and name to the Table
use persistent_keystore_rs::{Table, FieldType};
let table = Table::new()
.add_field("Count".to_string(), FieldType::I64).unwrap();
pub fn add_optional_field(
self,
key: String,
field_type: FieldType
) -> Result<Self, DatabaseError>
pub fn add_optional_field(
self,
key: String,
field_type: FieldType
) -> Result<Self, DatabaseError>
Add an optional field of FieldType and name to the Table
use persistent_keystore_rs::{Table, FieldType};
let table = Table::new()
.add_optional_field("Notes".to_string(), FieldType::String).unwrap();
Add an expiration Duration to the Table. The timer for the expiration is set to the last time an Entry was updated.
Note that this does not happen automatically within this struct; but is utilized within Client
use persistent_keystore_rs::{Table, FieldType};
use std::time::Duration;
let table = Table::new()
.add_expiration(Duration::from_secs(60));
Validates the Table is properly configured and returns the Table object.
use persistent_keystore_rs::{Table, FieldType};
use std::time::Duration;
let table = Table::new()
.name("MyTable".to_string())
.primary_field(FieldType::String).unwrap()
.add_field("Count".to_string(), FieldType::I64).unwrap()
.add_optional_field("Notes".to_string(), FieldType::String).unwrap()
.add_expiration(Duration::from_secs(60))
.build();
Auto Trait Implementations
impl RefUnwindSafe for TableBuilder
impl Send for TableBuilder
impl Sync for TableBuilder
impl Unpin for TableBuilder
impl UnwindSafe for TableBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more