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();

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

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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