pub struct StandardManager<Format> { /* private fields */ }Expand description
A standard implementation of FileManager. Provides options for file locking and file modes.
Trait Implementations§
Source§impl<Format: Debug> Debug for StandardManager<Format>
impl<Format: Debug> Debug for StandardManager<Format>
Source§impl<T, Format> FileManager<T> for StandardManager<Format>where
Format: FileFormat<T>,
impl<T, Format> FileManager<T> for StandardManager<Format>where
Format: FileFormat<T>,
Source§type Format = Format
type Format = Format
The
FileFormat of this FileManager.Source§type Options = StandardManagerOptions
type Options = StandardManagerOptions
Specifies the behavior of the
FileManager, required on instantiation.Source§type Error = Error<<<StandardManager<Format> as FileManager<T>>::Format as FileFormat<T>>::FormatError>
type Error = Error<<<StandardManager<Format> as FileManager<T>>::Format as FileFormat<T>>::FormatError>
The error type returned by methods of this
FileManager.Source§fn open<P: AsRef<Path>>(
path: P,
format: Self::Format,
options: Self::Options,
) -> Result<Self, Self::Error>
fn open<P: AsRef<Path>>( path: P, format: Self::Format, options: Self::Options, ) -> Result<Self, Self::Error>
Open a new instance of this
FileManager, returning an error if the file at the given path does not exist.Source§fn read(&mut self) -> Result<T, Self::Error>
fn read(&mut self) -> Result<T, Self::Error>
Reads a value from the file managed by this
FileManager.Source§fn write(&mut self, value: &T) -> Result<(), Self::Error>
fn write(&mut self, value: &T) -> Result<(), Self::Error>
Writes a value to the file managed by this
FileManager.Source§fn create_overwrite<P: AsRef<Path>>(
path: P,
format: Self::Format,
options: Self::Options,
value: T,
) -> Result<(T, Self), Self::Error>
fn create_overwrite<P: AsRef<Path>>( path: P, format: Self::Format, options: Self::Options, value: T, ) -> Result<(T, Self), Self::Error>
Open a new instance of this
FileManager, creating a file at the given path if it does not exist, and overwriting its contents if it does.Source§fn create_or<P: AsRef<Path>>(
path: P,
format: Self::Format,
options: Self::Options,
value: T,
) -> Result<(T, Self), Self::Error>
fn create_or<P: AsRef<Path>>( path: P, format: Self::Format, options: Self::Options, value: T, ) -> Result<(T, Self), Self::Error>
Open a new instance of this
FileManager, writing the given value to the file if it does not exist.Source§fn create_or_else<P: AsRef<Path>>(
path: P,
format: Self::Format,
options: Self::Options,
closure: impl FnOnce() -> T,
) -> Result<(T, Self), Self::Error>
fn create_or_else<P: AsRef<Path>>( path: P, format: Self::Format, options: Self::Options, closure: impl FnOnce() -> T, ) -> Result<(T, Self), Self::Error>
Open a new instance of this
FileManager, writing the result of the given closure to the file if it does not exist.Auto Trait Implementations§
impl<Format> Freeze for StandardManager<Format>where
Format: Freeze,
impl<Format> RefUnwindSafe for StandardManager<Format>where
Format: RefUnwindSafe,
impl<Format> Send for StandardManager<Format>where
Format: Send,
impl<Format> Sync for StandardManager<Format>where
Format: Sync,
impl<Format> Unpin for StandardManager<Format>where
Format: Unpin,
impl<Format> UnsafeUnpin for StandardManager<Format>where
Format: UnsafeUnpin,
impl<Format> UnwindSafe for StandardManager<Format>where
Format: UnwindSafe,
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