pub trait Synchronous {
    // Required methods
    fn set(&self, key: impl ToString, value: impl ToString) -> Result<(), Error>;
    fn get(&self, key: impl ToString) -> Result<String, Error>;
    fn delete(&self, key: impl ToString) -> Result<(), Error>;
    fn list(&self, prefix: Option<String>) -> Result<Vec<String>, Error>;
}
Expand description

Synchronous support for Database struct. Use this trait by import it then use it right away!

Required Methods§

source

fn set(&self, key: impl ToString, value: impl ToString) -> Result<(), Error>

Set a variable. key and value MUST implement std::string::ToString trait OR you could convert them to std::string::String instead.
Possible Exception is ErrorKind::HttpError for HttpError

source

fn get(&self, key: impl ToString) -> Result<String, Error>

Get a variable you just set. key MUST implement std::string::ToString trait OR you could convert them to std::string::String instead.
Possible Exceptions are ErrorKind::HttpError for HttpError, ErrorKind::NoItemFoundError for no items were found in the database

source

fn delete(&self, key: impl ToString) -> Result<(), Error>

Delete a variable you just set. MUST implement std::string::ToString trait OR you could convert them to std::string::String instead.
Possible Exceptions are ErrorKind::HttpError for HttpError, ErrorKind::NoItemFoundError for no items were found in the database

source

fn list(&self, prefix: Option<String>) -> Result<Vec<String>, Error>

List variables. Optionally finding variable that contains defined prefix by passing [Some("prefix")] instead of None
Possible Exceptions are ErrorKind::HttpError for HttpError, ErrorKind::DecodeError Decoding string error.

Implementors§