[][src]Struct toiletdb::Toiletdb

pub struct Toiletdb { /* fields omitted */ }

Toiletdb Struct with a file path and JSON state

Methods

impl Toiletdb[src]

pub fn new<P: Into<PathBuf>>(path: P) -> Result<Self, Error>[src]

pass the name of the JSON file to use

pub fn write<K, V>(&mut self, key: K, value: V) -> Result<(), Error> where
    K: Into<String>,
    V: Serialize
[src]

sets key to val inside the JSON file

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

read data from the JSON file

pub fn read_key<K: Into<String>>(&mut self, key: K) -> Option<&Value>[src]

read a value from a key

pub fn delete<K: Into<String>>(&mut self, key: K) -> Result<String, Error>[src]

deletes key from the JSON file

pub fn flush(&mut self) -> Result<(), Error>[src]

resets state and deletes the JSON file

Trait Implementations

impl Debug for Toiletdb[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> 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<V, T> VZip<V> for T where
    V: MultiLane<T>,