[−][src]Struct idmap::set::IdSet
A set, whose implement IntegerId
This is implemented directly as a bitset, so it may not be appropriate if you know you'll have large ids but few entries.
Implementations
impl<T: IntegerId> IdSet<T>
[src]
pub fn new() -> IdSet<T>
[src]
Create a new IdSet
pub fn with_capacity(indexes: usize) -> IdSet<T>
[src]
Initialize the set with the given capacity
Since the underlying storage is a simple bitset, this hints at the maximum capacity and not the length
pub fn insert<Q: Borrow<T>>(&mut self, value: Q) -> bool
[src]
Inserts the specified element into the set,
returning true
if it was already in the set and false
if it wasn't.
pub fn remove<Q: Borrow<T>>(&mut self, value: Q) -> bool
[src]
Remove the specified value from the set if it is present, returning whether or not it was present.
pub fn contains<Q: Borrow<T>>(&self, value: Q) -> bool
[src]
Check if this set contains the specified value
pub fn iter(&self) -> Iter<T>
[src]
Iterate over the values in this set
pub fn clear(&mut self)
[src]
Clear the values in this set
pub fn len(&self) -> usize
[src]
The number of entries in this set
An IdSet internally tracks this length, so this is a O(1)
operation
pub fn is_empty(&self) -> bool
[src]
If this set is empty
pub fn retain<F: FnMut(&T) -> bool>(&mut self, func: F)
[src]
Retain values in the set if the specified closure returns true
Otherwise they are removed
Trait Implementations
impl<T: Clone + IntegerId> Clone for IdSet<T>
[src]
impl<T: IntegerId> Debug for IdSet<T>
[src]
impl<T: IntegerId> Default for IdSet<T>
[src]
impl<'de, T> Deserialize<'de> for IdSet<T> where
T: IntegerId + Deserialize<'de>,
[src]
T: IntegerId + Deserialize<'de>,
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
[src]
impl<T: IntegerId + Eq> Eq for IdSet<T>
[src]
impl<'a, T: IntegerId + 'a> Extend<&'a T> for IdSet<T>
[src]
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
[src]
fn extend_one(&mut self, item: A)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]
impl<T: IntegerId> Extend<T> for IdSet<T>
[src]
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
[src]
fn extend_one(&mut self, item: A)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]
impl<'a, T: IntegerId + 'a> FromIterator<&'a T> for IdSet<T>
[src]
fn from_iter<I: IntoIterator<Item = &'a T>>(iter: I) -> Self
[src]
impl<T: IntegerId> FromIterator<T> for IdSet<T>
[src]
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self
[src]
impl<T: IntegerId + Hash> Hash for IdSet<T>
[src]
fn hash<H: Hasher>(&self, state: &mut H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl<'a, T: IntegerId + 'a> Index<&'a T> for IdSet<T>
[src]
type Output = bool
The returned type after indexing.
fn index(&self, index: &'a T) -> &Self::Output
[src]
impl<'a, T: IntegerId + 'a> Index<T> for IdSet<T>
[src]
impl<'a, T: IntegerId + 'a> IntoIterator for &'a IdSet<T>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = Iter<'a, T>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<T: IntegerId + Ord> Ord for IdSet<T>
[src]
fn cmp(&self, other: &IdSet<T>) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<T: IntegerId + PartialEq> PartialEq<IdSet<T>> for IdSet<T>
[src]
impl<T: IntegerId + PartialOrd> PartialOrd<IdSet<T>> for IdSet<T>
[src]
fn partial_cmp(&self, other: &IdSet<T>) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<T> Serialize for IdSet<T> where
T: IntegerId + Serialize,
[src]
T: IntegerId + Serialize,
impl<T: IntegerId> VisitMap<T> for IdSet<T>
[src]
Auto Trait Implementations
impl<T> RefUnwindSafe for IdSet<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for IdSet<T> where
T: Send,
T: Send,
impl<T> Sync for IdSet<T> where
T: Sync,
T: Sync,
impl<T> Unpin for IdSet<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for IdSet<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
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> 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>,