pub struct Generation { /* private fields */ }Expand description
A named monotonic counter.
Implementations§
Source§impl Generation
impl Generation
Sourcepub fn new(key: impl Into<String>) -> Self
pub fn new(key: impl Into<String>) -> Self
Name a counter. Many independent counters can coexist in one database.
Sourcepub fn ensure_schema(db: &dyn Backend) -> Result<()>
pub fn ensure_schema(db: &dyn Backend) -> Result<()>
Create the backing meta table if it does not exist. Idempotent.
Sourcepub fn current(&self, db: &dyn Backend) -> Result<u64>
pub fn current(&self, db: &dyn Backend) -> Result<u64>
The current value (0 if the counter has never been bumped).
Trait Implementations§
Source§impl Clone for Generation
impl Clone for Generation
Source§fn clone(&self) -> Generation
fn clone(&self) -> Generation
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Generation
impl RefUnwindSafe for Generation
impl Send for Generation
impl Sync for Generation
impl Unpin for Generation
impl UnsafeUnpin for Generation
impl UnwindSafe for Generation
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