Trait dscfg_server::Storage

source ·
pub trait Storage {
    type SetError: IsFatalError;
    type GetError: IsFatalError;

    fn set(&mut self, key: String, value: Value) -> Result<(), Self::SetError>;
    fn get(&mut self, key: &str) -> Result<Option<Value>, Self::GetError>;
}
Expand description

Specification of interface for accessing configuration.

The configuration can be stored using many different methods. In order to implement a new way of storing configuration data, you must implement this trait for your type.

Required Associated Types

Error which may occur when attempting to write to the storage.

Error which may occur when attempting to read from the storage.

Required Methods

When this function is called, the implementor must store the given value for key in the storage or return error in case of failure.

The implementor must return the value at given key (if exists, None if not) or error if getting fails.

Implementations on Foreign Types

Implementors