Struct btlib::atomic_file::SyncFile
source · pub struct SyncFile<T> { /* private fields */ }
Expand description
This struct provides synchronized access to a file such that two different processes cannot concurrently write to the same path.
Implementations§
source§impl<T: TryDefault + Serialize + DeserializeOwned> SyncFile<T>
impl<T: TryDefault + Serialize + DeserializeOwned> SyncFile<T>
sourcepub fn load_or_init(&self) -> Result<T>
pub fn load_or_init(&self) -> Result<T>
Load the current value from the file, or create a new value using the TryDefault trait, save it to the file and return it.
Auto Trait Implementations§
impl<T> RefUnwindSafe for SyncFile<T>where T: RefUnwindSafe,
impl<T> Send for SyncFile<T>where T: Send,
impl<T> Sync for SyncFile<T>where T: Sync,
impl<T> Unpin for SyncFile<T>where T: Unpin,
impl<T> UnwindSafe for SyncFile<T>where T: 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