Struct CounterMap
pub struct CounterMap { /* private fields */ }Implementations§
§impl CounterMap
impl CounterMap
pub const fn new() -> CounterMap
pub fn set(&mut self, key: &[u8], value: u32) -> Result<bool, MapFull>
pub fn set(&mut self, key: &[u8], value: u32) -> Result<bool, MapFull>
Upsert key to value. Returns whether the map changed (an
equal-value overwrite is a no-op, so callers can skip a flush).
pub fn clear(&mut self)
pub fn clear(&mut self)
Drop every entry (factory clear).
pub fn prune_tx_except(&mut self, keep: &[u8; 32]) -> bool
pub fn prune_tx_except(&mut self, keep: &[u8; 32]) -> bool
Drop TX-boundary entries belonging to any identity other than
keep and report whether anything was removed. TX contexts are
the MAC’s raw 32-byte identity public key; every other context
format (the 39-byte mac.rx: form) is left alone.
pub fn len(&self) -> usize
pub fn encode(&self, out: &mut [u8]) -> Option<usize>
pub fn encode(&self, out: &mut [u8]) -> Option<usize>
Serialize into out (sized ENCODED_MAX or larger); returns
the encoded length. Layout per entry: key length (1 byte), key,
little-endian u32 value.
pub fn decode(payload: &[u8]) -> Option<CounterMap>
pub fn decode(payload: &[u8]) -> Option<CounterMap>
Parse a persisted payload. Anything malformed — truncated
entries, oversized keys, more entries than capacity — yields
None, and the mount treats the journal as empty (counters
reseed, which is the safe direction for TX boundaries).
Trait Implementations§
§impl Clone for CounterMap
impl Clone for CounterMap
§fn clone(&self) -> CounterMap
fn clone(&self) -> CounterMap
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for CounterMap
impl Debug for CounterMap
§impl Default for CounterMap
impl Default for CounterMap
§fn default() -> CounterMap
fn default() -> CounterMap
§impl PartialEq for CounterMap
impl PartialEq for CounterMap
impl Eq for CounterMap
impl StructuralPartialEq for CounterMap
Auto Trait Implementations§
impl Freeze for CounterMap
impl RefUnwindSafe for CounterMap
impl Send for CounterMap
impl Sync for CounterMap
impl Unpin for CounterMap
impl UnwindSafe for CounterMap
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)