pub struct FileBackend(/* private fields */);
Expand description
A backend using a file.
Implementations§
Source§impl FileBackend
impl FileBackend
Source§impl FileBackend
impl FileBackend
Sourcepub fn from_path_or_fail<P: AsRef<Path>>(path: P) -> BackendResult<Self>
pub fn from_path_or_fail<P: AsRef<Path>>(path: P) -> BackendResult<Self>
Opens a new FileBackend
for a given path.
Errors when the file doesn’t yet exist.
Sourcepub fn from_path_or_create<P: AsRef<Path>>(
path: P,
) -> BackendResult<(Self, bool)>
pub fn from_path_or_create<P: AsRef<Path>>( path: P, ) -> BackendResult<(Self, bool)>
Opens a new FileBackend
for a given path.
Creates a file if it doesn’t yet exist.
Returns the FileBackend
and whether the file already existed.
Sourcepub fn from_path_or_create_and<P, C>(path: P, closure: C) -> BackendResult<Self>
pub fn from_path_or_create_and<P, C>(path: P, closure: C) -> BackendResult<Self>
Opens a new FileBackend
for a given path.
Creates a file if it doesn’t yet exist, and calls closure
with it.
Trait Implementations§
Source§impl Backend for FileBackend
impl Backend for FileBackend
Auto Trait Implementations§
impl Freeze for FileBackend
impl RefUnwindSafe for FileBackend
impl Send for FileBackend
impl Sync for FileBackend
impl Unpin for FileBackend
impl UnwindSafe for FileBackend
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