[−][src]Struct toiletdb::Toiletdb
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]
K: Into<String>,
V: Serialize,
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
Auto Trait Implementations
impl RefUnwindSafe for Toiletdb
impl Send for Toiletdb
impl Sync for Toiletdb
impl Unpin for Toiletdb
impl UnwindSafe for Toiletdb
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,