pub struct BoundedSeen<T> { /* private fields */ }Expand description
A set with a bounded capacity that evicts the oldest entry on overflow.
Insertion (insert) returns true when the item is new and was added,
false when it was already present. When len() == cap, the least
recently inserted item is removed before the new item is added.
Implementations§
Source§impl<T: Eq + Hash + Clone> BoundedSeen<T>
impl<T: Eq + Hash + Clone> BoundedSeen<T>
Sourcepub fn new(cap: usize) -> Self
pub fn new(cap: usize) -> Self
Creates a new set with the given capacity limit.
N=10000 is the recommended default per epoch (GTP §5, GSP §5).
Trait Implementations§
Source§impl<T: Clone> Clone for BoundedSeen<T>
impl<T: Clone> Clone for BoundedSeen<T>
Source§fn clone(&self) -> BoundedSeen<T>
fn clone(&self) -> BoundedSeen<T>
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<T> Freeze for BoundedSeen<T>
impl<T> RefUnwindSafe for BoundedSeen<T>where
T: RefUnwindSafe,
impl<T> Send for BoundedSeen<T>where
T: Send,
impl<T> Sync for BoundedSeen<T>where
T: Sync,
impl<T> Unpin for BoundedSeen<T>where
T: Unpin,
impl<T> UnsafeUnpin for BoundedSeen<T>
impl<T> UnwindSafe for BoundedSeen<T>where
T: 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