pub struct SetUsize(_);
Expand description
A set for usize elements.
Implementations
sourceimpl SetUsize
impl SetUsize
sourcepub fn with_capacity_of(other: &Self) -> Self
pub fn with_capacity_of(other: &Self) -> Self
Create an empty set with capacity to hold the provided set.
use tinyset::SetUsize;
let a: SetUsize = (1..300).collect();
let mut b = SetUsize::with_capacity_of(&a);
assert_eq!(a.capacity(), b.capacity());
assert_eq!(b.len(), 0);
for i in a.iter() {
b.insert(i);
}
assert_eq!(a.capacity(), b.capacity());
assert_eq!(b.len(), a.len());
Create an empty set with capacity to hold the provided set.
sourceimpl SetUsize
impl SetUsize
sourcepub fn insert(&mut self, elem: usize) -> bool
pub fn insert(&mut self, elem: usize) -> bool
Adds a value to the set.
If the set did not have this value present, true
is returned.
If the set did have this value present, false
is returned.
Trait Implementations
sourceimpl<'a, 'b> BitOr<&'b SetUsize> for &'a SetUsize
impl<'a, 'b> BitOr<&'b SetUsize> for &'a SetUsize
sourceimpl<'b> BitOr<&'b SetUsize> for SetUsize
impl<'b> BitOr<&'b SetUsize> for SetUsize
sourceimpl FromIterator<usize> for SetUsize
impl FromIterator<usize> for SetUsize
sourcefn from_iter<I: IntoIterator<Item = usize>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = usize>>(iter: I) -> Self
Creates a value from an iterator. Read more
sourceimpl IntoIterator for SetUsize
impl IntoIterator for SetUsize
sourceimpl<'a, 'b> Sub<&'b SetUsize> for &'a SetUsize
impl<'a, 'b> Sub<&'b SetUsize> for &'a SetUsize
sourceimpl<'b> Sub<&'b SetUsize> for SetUsize
impl<'b> Sub<&'b SetUsize> for SetUsize
impl Eq for SetUsize
Auto Trait Implementations
impl RefUnwindSafe for SetUsize
impl Send for SetUsize
impl Sync for SetUsize
impl Unpin for SetUsize
impl UnwindSafe for SetUsize
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more