[][src]Struct fs_db::FileStore

pub struct FileStore<V> { /* fields omitted */ }

A simple file system based key:value data store

Methods

impl<V, E> FileStore<V> where
    V: EncodeDecode<Value = V, Error = E> + Serialize + DeserializeOwned + Debug,
    E: Debug
[src]

pub fn new<P: AsRef<Path>>(dir: P) -> Result<Self, Error<E>>[src]

Create a new FileStore

pub fn list(&mut self) -> Result<Vec<String>, Error<E>>[src]

List all files in the database

pub fn load<P: AsRef<Path>>(&mut self, name: P) -> Result<V, Error<E>>[src]

Load a file by name

pub fn store<P: AsRef<Path>>(&mut self, name: P, v: &V) -> Result<(), Error<E>>[src]

Store a file by name

pub fn load_all(&mut self) -> Result<Vec<(String, V)>, Error<E>>[src]

Load all files from the database

pub fn store_all(&mut self, data: &[(String, V)]) -> Result<(), Error<E>>[src]

Store a colection of files in the database

pub fn rm<P: AsRef<Path>>(&mut self, name: P) -> Result<(), Error<E>>[src]

Remove a file from the database

Auto Trait Implementations

impl<V> Send for FileStore<V> where
    V: Send

impl<V> Sync for FileStore<V> where
    V: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]