pub struct PairTable { /* private fields */ }Expand description
A bounded key→value table (drop-oldest), for pending pairing state: inbound knocks (sender key → claimed name) and outbound requests (target key → the grant we’ll assign them on accept). Bounded so a knock flood can’t grow it.
Implementations§
Source§impl PairTable
impl PairTable
pub fn new(cap: usize) -> Self
Sourcepub fn put(&mut self, key: String, value: String)
pub fn put(&mut self, key: String, value: String)
Insert or update key; evicts the oldest at capacity.
pub fn get(&self, key: &str) -> Option<&String>
Sourcepub fn find(&self, key_or_fp: &str) -> Option<(String, String)>
pub fn find(&self, key_or_fp: &str) -> Option<(String, String)>
Resolve a full key or an exact 8-char fingerprint to (key, value).
pub fn entries(&self) -> impl Iterator<Item = (&String, &String)>
pub fn is_empty(&self) -> bool
Auto Trait Implementations§
impl Freeze for PairTable
impl RefUnwindSafe for PairTable
impl Send for PairTable
impl Sync for PairTable
impl Unpin for PairTable
impl UnsafeUnpin for PairTable
impl UnwindSafe for PairTable
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