pub struct PathBackend { /* private fields */ }
Expand description
A Backend
using a file given the path.
Features atomic saves, so that the database file won’t be corrupted or deleted if the program panics during the save.
Implementations§
Source§impl PathBackend
impl PathBackend
Sourcepub fn from_path_or_fail(path: PathBuf) -> BackendResult<Self>
pub fn from_path_or_fail(path: PathBuf) -> BackendResult<Self>
Opens a new PathBackend
for a given path.
Errors when the file doesn’t yet exist.
Sourcepub fn from_path_or_create(path: PathBuf) -> BackendResult<(Self, bool)>
pub fn from_path_or_create(path: PathBuf) -> BackendResult<(Self, bool)>
Opens a new PathBackend
for a given path.
Creates a file if it doesn’t yet exist.
Returns the PathBackend
and whether the file already existed.
Sourcepub fn from_path_or_create_and<C>(
path: PathBuf,
closure: C,
) -> BackendResult<Self>
pub fn from_path_or_create_and<C>( path: PathBuf, closure: C, ) -> BackendResult<Self>
Opens a new PathBackend
for a given path.
Creates a file if it doesn’t yet exist, and calls closure
with it.
Trait Implementations§
Source§impl Backend for PathBackend
impl Backend for PathBackend
Auto Trait Implementations§
impl Freeze for PathBackend
impl RefUnwindSafe for PathBackend
impl Send for PathBackend
impl Sync for PathBackend
impl Unpin for PathBackend
impl UnwindSafe for PathBackend
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