Struct sudoku_variants::util::USizeSet [−][src]
A set of usize
that is implemented as a bit vector. Each usize
that is
in the range of possible elements is represented by one bit in a vector of
numbers. This generally has better performance than a HashSet
.
Implementations
impl USizeSet
[src]
pub fn new(min: usize, max: usize) -> USizeSetResult<USizeSet>
[src]
Creates a new, empty USizeSet
with the given (inclusive) bounds.
Arguments
min
: The minimum value that can be contained in the created set. Any values lower than that will yield aUSizeSetError::OutOfBounds
if inserted or removed. Must be less than or equal tomax
.max
: The maximum value that can be contained in the created set. Any values higher than that will yield aUSizeSetError::OutOfBounds
if inserted or removed. Must be greater than or equal tomin
.
Errors
If min > max
. In that case, a USizeSetError::InvalidBounds
is
returned.
pub fn singleton(
min: usize,
max: usize,
content: usize
) -> USizeSetResult<USizeSet>
[src]
min: usize,
max: usize,
content: usize
) -> USizeSetResult<USizeSet>
Creates a new singleton USizeSet
with the given (inclusive) bounds.
The set contains one element, which is specified by content
.
Arguments
min
: The minimum value that can be contained in the created set. Any values lower than that will yield aUSizeSetError::OutOfBounds
if inserted or removed. Must be less than or equal tomax
.max
: The maximum value that can be contained in the created set. Any values higher than that will yield aUSizeSetError::OutOfBounds
if inserted or removed. Must be greater than or equal tomin
.content
: The only element contained by the created set. Must be within the bounds.
Errors
USizeSetError::InvalidBounds
: Ifmin > max
.USizeSetError::OutOfBounds
: Ifcontent < min
orcontent > max
.
pub fn range(min: usize, max: usize) -> USizeSetResult<USizeSet>
[src]
Creates a new USizeSet
that includes all numbers in the given
(inclusive) bounds. Note that these bounds also apply later.
Arguments
min
: The minimum value contained in the created set, which is also the minimum that can be contained. Any values lower than this will yield aUSizeSetError::OutOfBounds
if inserted or removed. Must be less than or equal tomax
.max
: The maximum value contained in the created set, which is also the maximum value that can be contained. Any values higher than this will yield aUSizeSetError::OutOfBounds
if inserted or removed. Must be greater than or equal tomin
.
Errors
If min > max
. In that case, a USizeSetError::InvalidBounds
is
returned.
pub fn min(&self) -> usize
[src]
Returns the minimum value that this set can contain (inclusive).
pub fn max(&self) -> usize
[src]
Returns the maximum value that this set can contain (inclusive).
pub fn contains(&self, number: usize) -> bool
[src]
Indicates whether this set contains the given number, in which case
this method returns true
. If it is not contained or outside the
bounds, false
will be returned.
pub fn insert(&mut self, number: usize) -> USizeSetResult<bool>
[src]
Inserts the given number into this set, such that USizeSet::contains
returns true
for this number afterwards. Note that it must be within
the bounds provided at construction time.
This method returns true
if the set has changed (i.e. the number was
not present before) and false
otherwise.
Errors
If number
is less than USizeSet::min or greater than
USizeSet::max. In that case, USizeSetError::OutOfBounds
is
returned.
pub fn remove(&mut self, number: usize) -> USizeSetResult<bool>
[src]
Removes the given number from this set, such that USizeSet::contains
returns false
for this number afterwards. Note that it must be within
the bounds provided at construction time.
This method returns true
if the set has changed (i.e. the number was
present before) and false
otherwise.
Errors
If number
is less than USizeSet::min or greater than
USizeSet::max. In that case, USizeSetError::OutOfBounds
is
returned.
pub fn clear(&mut self)
[src]
Removes all numbers from this set, such that USizeSet::contains will
return false
for all inputs and USizeSet::is_empty will return
true
.
pub fn iter(&self) -> USizeSetIter<'_>ⓘNotable traits for USizeSetIter<'a>
impl<'a> Iterator for USizeSetIter<'a> type Item = usize;
[src]
Notable traits for USizeSetIter<'a>
impl<'a> Iterator for USizeSetIter<'a> type Item = usize;
Returns an iterator over the numbers contained in this set in ascending order.
pub fn is_empty(&self) -> bool
[src]
Indicates whether this set is empty, i.e. contains no numbers. If this
method returns true
, USizeSet::contains will return false
for all
inputs.
pub fn len(&self) -> usize
[src]
Returns the number of elements contained in this set.
pub fn union_assign(&mut self, other: &USizeSet) -> USizeSetResult<bool>
[src]
Computes the set union between this and the given set and stores the
result in this set. The bounds of this set and other
must be equal.
USizeSet
implements BitOrAssign as syntactic sugar for this
operation. Note that that implementation panics instead of returning
potential errors.
Returns
True, if and only if this set changed as a result of the operation.
Errors
If either the minimum or maximum of this set and other
are different.
In that case, USizeError::DifferentBounds
is returned.
pub fn union(&self, other: &USizeSet) -> USizeSetResult<USizeSet>
[src]
Computes the set union between this and the given set and stores the
result in a new set which is returned. The bounds of this set and
other
must be equal.
USizeSet
implements BitOr as syntactic sugar for this operation.
Note that that implementation panics instead of returning potential
errors.
Errors
If the minimum or maximum of this set and other
are different. In
that case, USizeError::DifferentBounds
is returned.
pub fn intersect_assign(&mut self, other: &USizeSet) -> USizeSetResult<bool>
[src]
Computes the set intersection between this and the given set and stores
the result in this set. The bounds of this set and other
must be
equal.
USizeSet
implements BitAndAssign as syntactic sugar for this
operation. Note that that implementation panics instead of returning
potential errors.
Returns
True, if and only if this set changed as a result of the operation.
Errors
If the minimum or maximum of this set and other
are different. In
that case, USizeError::DifferentBounds
is returned.
pub fn intersect(&self, other: &USizeSet) -> USizeSetResult<USizeSet>
[src]
Computes the set intersection between this and the given set and stores
the result in a new set which is returned. The bounds of this set and
other
must be equal.
USizeSet
implements BitAnd as syntactic sugar for this operation.
Note that that implementation panics instead of returning potential
errors.
Errors
If the minimum or maximum of this set and other
are different. In
that case, USizeError::DifferentBounds
is returned.
pub fn difference_assign(&mut self, other: &USizeSet) -> USizeSetResult<bool>
[src]
Computes the set difference between this and the given set and stores
the result in this set. The bounds of this set and other
must be
equal. other
acts as the right-hand-side, meaning its elements are
removed from the result.
USizeSet
implements SubAssign as syntactic sugar for this
operation. Note that that implementation panics instead of returning
potential errors.
Returns
True, if and only if this set changed as a result of the operation.
Errors
If the minimum or maximum of this set and other
are different. In
that case, USizeError::DifferentBounds
is returned.
pub fn difference(&self, other: &USizeSet) -> USizeSetResult<USizeSet>
[src]
Computes the set difference between this and the given set and stores
the result in a new set which is returned. The bounds of this set and
other
must be equal.
USizeSet
implements Sub as syntactic sugar for this operation. Note
that that implementation panics instead of returning potential errors.
Errors
If the minimum or maximum of this set and other
are different. In
that case, USizeError::DifferentBounds
is returned.
pub fn symmetric_difference_assign(
&mut self,
other: &USizeSet
) -> USizeSetResult<bool>
[src]
&mut self,
other: &USizeSet
) -> USizeSetResult<bool>
Computes the symmetric set difference between this and the given set
and stores the result in this set. The bounds of this set and other
must be equal.
USizeSet
implements BitXorAssign as syntactic sugar for this
operation. Note that that implementation panics instead of returning
potential errors.
Returns
True, if and only if this set changed as a result of the operation.
Errors
If the minimum or maximum of this set and other
are different. In
that case, USizeError::DifferentBounds
is returned.
pub fn symmetric_difference(&self, other: &USizeSet) -> USizeSetResult<USizeSet>
[src]
Computes the symmetric set difference between this and the given set
and stores the result in a new set which is returned. The bounds of
this set and other
must be equal.
USizeSet
implements BitXor as syntactic sugar for this operation.
Note that that implementation panics instead of returning potential
errors.
Errors
If the minimum or maximum of this set and other
are different. In
that case, USizeError::DifferentBounds
is returned.
Trait Implementations
impl BitAnd<&'_ USizeSet> for USizeSet
[src]
type Output = USizeSet
The resulting type after applying the &
operator.
fn bitand(self, rhs: &USizeSet) -> USizeSet
[src]
impl BitAnd<&'_ USizeSet> for &USizeSet
[src]
type Output = USizeSet
The resulting type after applying the &
operator.
fn bitand(self, rhs: &USizeSet) -> USizeSet
[src]
impl BitAndAssign<&'_ USizeSet> for USizeSet
[src]
fn bitand_assign(&mut self, rhs: &USizeSet)
[src]
impl BitAndAssign<&'_ USizeSet> for &mut USizeSet
[src]
fn bitand_assign(&mut self, rhs: &USizeSet)
[src]
impl BitOr<&'_ USizeSet> for USizeSet
[src]
type Output = USizeSet
The resulting type after applying the |
operator.
fn bitor(self, rhs: &USizeSet) -> USizeSet
[src]
impl BitOr<&'_ USizeSet> for &USizeSet
[src]
type Output = USizeSet
The resulting type after applying the |
operator.
fn bitor(self, rhs: &USizeSet) -> USizeSet
[src]
impl BitOrAssign<&'_ USizeSet> for USizeSet
[src]
fn bitor_assign(&mut self, rhs: &USizeSet)
[src]
impl BitOrAssign<&'_ USizeSet> for &mut USizeSet
[src]
fn bitor_assign(&mut self, rhs: &USizeSet)
[src]
impl BitXor<&'_ USizeSet> for USizeSet
[src]
type Output = USizeSet
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: &USizeSet) -> USizeSet
[src]
impl BitXor<&'_ USizeSet> for &USizeSet
[src]
type Output = USizeSet
The resulting type after applying the ^
operator.
fn bitxor(self, rhs: &USizeSet) -> USizeSet
[src]
impl BitXorAssign<&'_ USizeSet> for USizeSet
[src]
fn bitxor_assign(&mut self, rhs: &USizeSet)
[src]
impl BitXorAssign<&'_ USizeSet> for &mut USizeSet
[src]
fn bitxor_assign(&mut self, rhs: &USizeSet)
[src]
impl Clone for USizeSet
[src]
impl Debug for USizeSet
[src]
impl Eq for USizeSet
[src]
impl PartialEq<USizeSet> for USizeSet
[src]
impl StructuralEq for USizeSet
[src]
impl StructuralPartialEq for USizeSet
[src]
impl Sub<&'_ USizeSet> for USizeSet
[src]
type Output = USizeSet
The resulting type after applying the -
operator.
fn sub(self, rhs: &USizeSet) -> USizeSet
[src]
impl Sub<&'_ USizeSet> for &USizeSet
[src]
type Output = USizeSet
The resulting type after applying the -
operator.
fn sub(self, rhs: &USizeSet) -> USizeSet
[src]
impl SubAssign<&'_ USizeSet> for USizeSet
[src]
fn sub_assign(&mut self, rhs: &USizeSet)
[src]
impl SubAssign<&'_ USizeSet> for &mut USizeSet
[src]
fn sub_assign(&mut self, rhs: &USizeSet)
[src]
Auto Trait Implementations
impl RefUnwindSafe for USizeSet
impl Send for USizeSet
impl Sync for USizeSet
impl Unpin for USizeSet
impl UnwindSafe for USizeSet
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,
pub fn borrow_mut(&mut self) -> &mut T
[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.
pub fn to_owned(&self) -> T
[src]
pub 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.
pub 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.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,