pub struct DocDb { /* private fields */ }Implementations§
Source§impl DocDb
impl DocDb
pub fn new<P: AsRef<Path>>( db_path: P, dump_policy: DumpPolicy, serialize_method: SerializationMethod, ) -> Self
pub fn new_json<P: AsRef<Path>>(db_path: P, dump_policy: DumpPolicy) -> Self
pub fn load<P: AsRef<Path>>( db_path: P, dump_policy: DumpPolicy, ser_method: SerializationMethod, ) -> Result<DocDb>
pub fn load_read_only<P: AsRef<Path>>( db_path: P, serialization_method: SerializationMethod, ) -> Result<DocDb>
pub fn load_json<P: AsRef<Path>>( db_path: P, dump_policy: DumpPolicy, ) -> Result<Self>
pub fn dump(&mut self) -> Result<()>
pub fn dump_now(&mut self) -> Result<()>
pub fn set<T: Serialize>(&mut self, key: &str, val: &T) -> Result<()>
pub fn get<T: DeserializeOwned>(&self, key: &str) -> Option<T>
pub fn exist(&self, key: &str) -> bool
Sourcepub fn get_all_keys(&self) -> Vec<String>
pub fn get_all_keys(&self) -> Vec<String>
Get a vector of all the keys in the DB.
The keys returned in the vector are not references to the actual key string objects but rather a clone of them.
Sourcepub fn total_nums(&self) -> usize
pub fn total_nums(&self) -> usize
Get the total number of keys in the DB.
pub fn rem(&mut self, key: &str) -> Result<bool>
pub fn iter(&self) -> DocDbIterator<'_> ⓘ
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DocDb
impl RefUnwindSafe for DocDb
impl Send for DocDb
impl Sync for DocDb
impl Unpin for DocDb
impl UnwindSafe for DocDb
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more