pub struct FileStore<S> { /* private fields */ }Expand description
State held in one JSON document, so a second process — the next onevcs
invocation — sees what the first one left.
Implementations§
Source§impl<S: Serialize + DeserializeOwned + Checked> FileStore<S>
impl<S: Serialize + DeserializeOwned + Checked> FileStore<S>
Sourcepub fn attach(path: impl Into<PathBuf>, fallback: &S) -> Result<Self>
pub fn attach(path: impl Into<PathBuf>, fallback: &S) -> Result<Self>
The store at path: whatever is already there, or fallback written out.
Attaching rather than replacing is what makes a second provider over the same path the same state — which is the whole reason to keep it in a file. A document that is there but is not this shape is refused here rather than at whichever call first read it.
Trait Implementations§
Auto Trait Implementations§
impl<S> Freeze for FileStore<S>
impl<S> RefUnwindSafe for FileStore<S>where
S: RefUnwindSafe,
impl<S> Send for FileStore<S>where
S: Send,
impl<S> Sync for FileStore<S>where
S: Sync,
impl<S> Unpin for FileStore<S>where
S: Unpin,
impl<S> UnsafeUnpin for FileStore<S>
impl<S> UnwindSafe for FileStore<S>where
S: 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