pub struct LazyContainer { /* private fields */ }
Expand description
A wrapper for a directory that holds individual LazyData
files
Implementations§
Source§impl LazyContainer
impl LazyContainer
Sourcepub fn init(path: impl AsRef<Path>) -> Result<Self, Error>
pub fn init(path: impl AsRef<Path>) -> Result<Self, Error>
Initialises a new, empty LazyContainer
at the specified path.
Sourcepub fn load(path: impl AsRef<Path>) -> Result<Self, LDBError>
pub fn load(path: impl AsRef<Path>) -> Result<Self, LDBError>
Loads a pre-existing LazyContainer
directory at a specified path.
Will throw an error if the directory doesn’t exist or there is an io::Error
.
Sourcepub fn data_writer(
&self,
key: impl AsRef<Path>,
) -> Result<FileWrapper, LDBError>
pub fn data_writer( &self, key: impl AsRef<Path>, ) -> Result<FileWrapper, LDBError>
Generates a FileWrapper
in write mode from a key (like a relative file path)
If the data already exists, it will try to remove it
Sourcepub fn new_container(
&self,
key: impl AsRef<Path>,
) -> Result<LazyContainer, LDBError>
pub fn new_container( &self, key: impl AsRef<Path>, ) -> Result<LazyContainer, LDBError>
Generates a nested LazyContainer
within this container
If container already exists it will wipe and replace it.
Sourcepub fn child_container(
&self,
key: impl AsRef<Path>,
) -> Result<LazyContainer, LDBError>
pub fn child_container( &self, key: impl AsRef<Path>, ) -> Result<LazyContainer, LDBError>
Gets a nested LazyContainer
within this container
If container already exists it will load it Otherwise it will initialise a new one
Sourcepub fn read_data(&self, key: impl AsRef<Path>) -> Result<LazyData, LDBError>
pub fn read_data(&self, key: impl AsRef<Path>) -> Result<LazyData, LDBError>
Reads nested LazyData
within this container
Sourcepub fn read_container(
&self,
key: impl AsRef<Path>,
) -> Result<LazyContainer, LDBError>
pub fn read_container( &self, key: impl AsRef<Path>, ) -> Result<LazyContainer, LDBError>
Reads nexted LazyContainer
within this container
Auto Trait Implementations§
impl Freeze for LazyContainer
impl RefUnwindSafe for LazyContainer
impl Send for LazyContainer
impl Sync for LazyContainer
impl Unpin for LazyContainer
impl UnwindSafe for LazyContainer
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