pub struct SetU32(_);
Expand description

A set of u32

Implementations

Returns true if the set is empty

Create an empty set with capacity to hold the provided set.

use tinyset::SetU32;

let a: SetU32 = (1..300).collect();
let mut b = SetU32::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());

The number of elements in the set

The capacity of the set

Print debugging information about this set.

Tally up how much memory is in use.

Create a set with the given capacity

Create a set with the given capacity and bits

An empty set

Insert and return true if it was not present.

Remove

Contais

Iterate over

Clears the set, returning all elements in an iterator.

Trait Implementations

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

Examples
let a: tinyset::SetU32 = (1..4).collect();
let b: tinyset::SetU32 = (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 SetU32, consuming self.

Examples
let a: tinyset::SetU32 = (1..4).collect();
let b: tinyset::SetU32 = (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

Returns the “default value” for a type. Read more

Executes the destructor for this type. Read more

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 SetU32.

Examples
let a: tinyset::SetU32 = (1..4).collect();
let b: tinyset::SetU32 = (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 SetU32 consuming self. Should not allocate.

Examples
let a: tinyset::SetU32 = (1..4).collect();
let b: tinyset::SetU32 = (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.