pub struct SetUsize(_);
Expand description

A set for usize elements.

Implementations

Returns true if the set is empty

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.

Creates an empty set..

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.

Returns the number of elements in the set.

Returns the capacity of the set.

Returns true if the set contains a value.

Removes an element, and returns true if that element was present.

Iterate

Drain

Trait Implementations

Returns the union of self and rhs as a new SetUsize.

Examples
let a: tinyset::SetUsize = (1..4).collect();
let b: tinyset::SetUsize = (3..6).collect();

assert_eq!(&a | &b, (1..6).collect());

The resulting type after applying the | operator.

Returns the union of self and rhs as a new SetUsize, consuming self.

Examples
let a: tinyset::SetUsize = (1..4).collect();
let b: tinyset::SetUsize = (3..6).collect();

assert_eq!(a | &b, (1..6).collect());

The resulting type after applying the | operator.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Creates an empty set..

Creates a value from an iterator. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Returns the difference of self and rhs as a new SetUsize.

Examples
let a: tinyset::SetUsize = (1..4).collect();
let b: tinyset::SetUsize = (3..6).into_iter().collect();

assert_eq!(&a - &b, (1..3).collect());

The resulting type after applying the - operator.

Returns the difference of self and rhs as a new SetUsize consuming self. Should not allocate.

Examples
let a: tinyset::SetUsize = (1..4).collect();
let b: tinyset::SetUsize = (3..6).into_iter().collect();

assert_eq!(a - &b, (1..3).collect());

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.