pub struct GrantStore { /* private fields */ }Expand description
Grants kept in a file.
Implementations§
Source§impl GrantStore
impl GrantStore
Sourcepub fn load(&self) -> BTreeMap<String, Stored>
pub fn load(&self) -> BTreeMap<String, Stored>
Read every stored grant.
An absent, unreadable or malformed store reads as empty rather than as an error: the worst that costs is a trip through the chooser, whereas refusing to start would lock a caller out of its own devices.
Sourcepub fn save(&self, devices: &BTreeMap<String, Stored>) -> Result<()>
pub fn save(&self, devices: &BTreeMap<String, Stored>) -> Result<()>
Write every grant, replacing what was there.
Written to a temporary file and renamed, so an interrupted write leaves the previous store intact rather than a half-written one. A permission store truncated by a crash would silently revoke everything.
Trait Implementations§
Source§impl Clone for GrantStore
impl Clone for GrantStore
Auto Trait Implementations§
impl Forget for GrantStore
impl Freeze for GrantStore
impl Move for GrantStore
impl RefUnwindSafe for GrantStore
impl Send for GrantStore
impl Sync for GrantStore
impl Unpin for GrantStore
impl UnsafeUnpin for GrantStore
impl UnwindSafe for GrantStore
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