Struct LazyContainer

Source
pub struct LazyContainer { /* private fields */ }
Expand description

A wrapper for a directory that holds individual LazyData files

Implementations§

Source§

impl LazyContainer

Source

pub fn init(path: impl AsRef<Path>) -> Result<Self, Error>

Initialises a new, empty LazyContainer at the specified path.

Source

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.

Source

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

Source

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.

Source

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

Source

pub fn read_data(&self, key: impl AsRef<Path>) -> Result<LazyData, LDBError>

Reads nested LazyData within this container

Source

pub fn read_container( &self, key: impl AsRef<Path>, ) -> Result<LazyContainer, LDBError>

Reads nexted LazyContainer within this container

Source

pub fn remove(&self, key: impl AsRef<Path>) -> Result<(), Error>

Tries to remove item at specified key; returns result

Source

pub fn wipe(&self) -> Result<(), Error>

Tries to wipe container’s contents; returns result

Source

pub fn path(&self) -> &Path

Returns a reference to the container’s path

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.