[−][src]Struct pagecache::VecSet
A set built on top of Vec
and binary search,
for use when calling nth
to iterate over a set
is too expensive, and the set size is expected to be
~10 or less most of the time.
Methods
impl<T> VecSet<T> where
T: Ord + Eq,
[src]
T: Ord + Eq,
pub fn insert(&mut self, item: T) -> bool
[src]
Insert a new item
pub fn remove(&mut self, item: &T) -> Option<T>
[src]
Removes an item by value
pub fn contains(&self, item: &T) -> bool
[src]
Returns true
if the item is present
pub fn peek_first(&self) -> Option<&T>
[src]
Peeks the first element
pub fn is_empty(&self) -> bool
[src]
Returns true
if the set is empty
pub fn len(&self) -> usize
[src]
Returns the size of the set
pub fn get(&self, idx: usize) -> Option<&T>
[src]
Indexes into the underlying buffer
pub fn clear(&mut self)
[src]
Clears the underlying buffer
pub fn iter(&self) -> impl Iterator<Item = &T>
[src]
Iterate over the contents of this set
Trait Implementations
impl<T: Default> Default for VecSet<T>
[src]
impl<T: Clone> Clone for VecSet<T>
[src]
impl<T: PartialEq> PartialEq<VecSet<T>> for VecSet<T>
[src]
impl<T: Debug> Debug for VecSet<T>
[src]
impl<T> Serialize for VecSet<T> where
T: Serialize,
[src]
T: Serialize,
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de, T> Deserialize<'de> for VecSet<T> where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
impl<T> Unpin for VecSet<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for VecSet<T> where
T: Sync,
T: Sync,
impl<T> Send for VecSet<T> where
T: Send,
T: Send,
impl<T> UnwindSafe for VecSet<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for VecSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,