Trait key_store::traits::KeyStore[][src]

pub trait KeyStore: Send + Sync {
    type KeyStoreId;
    type Error: Debug + Clone + PartialEq + Into<String>;
    fn store_with_status(
        &self,
        k: &Self::KeyStoreId,
        v: &impl KeyStoreValue,
        s: Status
    ) -> Result<(), Self::Error>
    where
        Self: Sized
;
fn store(
        &self,
        k: &Self::KeyStoreId,
        v: &impl KeyStoreValue
    ) -> Result<(), Self::Error>
    where
        Self: Sized
;
fn read<V: KeyStoreValue>(
        &self,
        k: &Self::KeyStoreId
    ) -> Result<V, Self::Error>
    where
        Self: Sized
;
fn update(
        &self,
        k: &Self::KeyStoreId,
        v: &impl KeyStoreValue
    ) -> Result<(), Self::Error>
    where
        Self: Sized
;
fn delete(&self, k: &Self::KeyStoreId) -> Result<(), Self::Error>
    where
        Self: Sized
; }

The Key Store trait

Associated Types

type KeyStoreId[src]

The type of the identifier used by the key store to identify values in the key store.

type Error: Debug + Clone + PartialEq + Into<String>[src]

The error type returned by the KeyStore.

Loading content...

Required methods

fn store_with_status(
    &self,
    k: &Self::KeyStoreId,
    v: &impl KeyStoreValue,
    s: Status
) -> Result<(), Self::Error> where
    Self: Sized
[src]

Store a value v that implements the KeyStoreValue trait for serialization with Status s under ID k.

Returns an error if storing fails.

fn store(
    &self,
    k: &Self::KeyStoreId,
    v: &impl KeyStoreValue
) -> Result<(), Self::Error> where
    Self: Sized
[src]

Store a value v that implements the KeyStoreValue trait for serialization for ID k. The status will always be Status::Extractable. To set the status of the value v use store_with_status.

Returns an error if storing fails.

fn read<V: KeyStoreValue>(&self, k: &Self::KeyStoreId) -> Result<V, Self::Error> where
    Self: Sized
[src]

Read and return a value stored for ID k that implements the KeyStoreValue trait for deserialization. If the value is marked as Status::Hidden, an error will be returned.

Returns an error if storing fails.

fn update(
    &self,
    k: &Self::KeyStoreId,
    v: &impl KeyStoreValue
) -> Result<(), Self::Error> where
    Self: Sized
[src]

Update a value stored for ID k with a new value v that implements the KeyStoreValue trait for serialization.

Returns an error if storing fails.

fn delete(&self, k: &Self::KeyStoreId) -> Result<(), Self::Error> where
    Self: Sized
[src]

Delete a value stored for ID k.

Returns an error if storing fails.

Loading content...

Implementors

Loading content...