Skip to main content

UpperBoundedSet

Struct UpperBoundedSet 

Source
pub struct UpperBoundedSet<T> { /* private fields */ }
Expand description

A set of ranges with a finite upper bound but no lower bound.

While an UpperBoundedSet can be constructed directly, it will most likely arise as a result of one or more range operations.

use rangetools::{UpperBoundedSet, Rangetools};

let s: UpperBoundedSet<_> = (10..20).union(..5);

Implementations§

Source§

impl<T: Copy + Ord> UpperBoundedSet<T>

Source

pub fn contains(&self, t: T) -> bool

Returns true if the set contains t.

§Example
use rangetools::Rangetools;

let s = (10..20).union(..5);
assert!(s.contains(0));
assert!(!s.contains(42));

Trait Implementations§

Source§

impl<T: Clone> Clone for UpperBoundedSet<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for UpperBoundedSet<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Eq> Eq for UpperBoundedSet<T>

Source§

impl<T> From<UpperBoundedRange<T>> for UpperBoundedSet<T>

Source§

fn from(upper_bounded_range: UpperBoundedRange<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for UpperBoundedSet<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: PartialEq> PartialEq for UpperBoundedSet<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T> RangeComplement<LowerBoundedSet<T>> for UpperBoundedSet<T>
where T: Copy + Ord,

Source§

fn complement(self) -> LowerBoundedSet<T>

Returns a set of all the elements not in self.
Source§

impl<T> RangeComplement<UpperBoundedSet<T>> for LowerBoundedSet<T>
where T: Copy + Ord,

Source§

fn complement(self) -> UpperBoundedSet<T>

Returns a set of all the elements not in self.
Source§

impl<T, R> RangeIntersection<R, BoundedRange<T>> for UpperBoundedSet<T>
where R: Rangetools<Inner = BoundedRange<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, BoundedSet<T>> for UpperBoundedSet<T>
where R: Rangetools<Inner = BoundedSet<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, EmptyRange<T>> for UpperBoundedSet<T>
where R: Rangetools<Inner = EmptyRange<T>>, T: Copy + Ord,

Source§

type Output = EmptyRange<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, LowerBoundedRange<T>> for UpperBoundedSet<T>
where R: Rangetools<Inner = LowerBoundedRange<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, LowerBoundedSet<T>> for UpperBoundedSet<T>
where R: Rangetools<Inner = LowerBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UnboundedRange> for UpperBoundedSet<T>
where R: Rangetools<Inner = UnboundedRange>,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, _: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UnboundedSet<T>> for UpperBoundedSet<T>
where R: Rangetools<Inner = UnboundedSet<T>> + Clone, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedRange<T>> for UpperBoundedSet<T>
where R: Rangetools<Inner = UpperBoundedRange<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for Range<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for RangeFrom<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for RangeFull
where R: Rangetools<Inner = UpperBoundedSet<T>>,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for RangeInclusive<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for RangeTo<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for RangeToInclusive<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for BoundedRange<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for LowerBoundedRange<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for UpperBoundedRange<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for BoundedSet<T>
where R: Rangetools<Inner = UpperBoundedSet<T>> + Clone, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for LowerBoundedSet<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = BoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for UnboundedSet<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeIntersection<R, UpperBoundedSet<T>> for UpperBoundedSet<T>
where R: Rangetools<Inner = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the intersection.
Source§

fn intersection(self, other: R) -> Self::Output

Returns the set intersection of self and other.
Source§

impl<T, R> RangeUnion<R, BoundedSet<T>> for UpperBoundedSet<T>
where R: Rangetools<Set = BoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, EmptyRange<T>> for UpperBoundedSet<T>
where R: Rangetools<Set = EmptyRange<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, LowerBoundedSet<T>> for UpperBoundedSet<T>
where R: Rangetools<Set = LowerBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UnboundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UnboundedRange> for UpperBoundedSet<T>
where R: Rangetools<Set = UnboundedRange>, T: Copy + Ord,

Source§

type Output = UnboundedRange

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UnboundedSet<T>> for UpperBoundedSet<T>
where R: Rangetools<Set = UnboundedSet<T>>, T: Copy + Ord,

Source§

type Output = UnboundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for Range<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for RangeFrom<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UnboundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for RangeFull
where R: Rangetools<Set = UpperBoundedSet<T>>,

Source§

type Output = UnboundedRange

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for RangeInclusive<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for RangeTo<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for RangeToInclusive<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for BoundedRange<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for LowerBoundedRange<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UnboundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for UpperBoundedRange<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for BoundedSet<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for LowerBoundedSet<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UnboundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for UnboundedSet<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UnboundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T, R> RangeUnion<R, UpperBoundedSet<T>> for UpperBoundedSet<T>
where R: Rangetools<Set = UpperBoundedSet<T>>, T: Copy + Ord,

Source§

type Output = UpperBoundedSet<T>

The output type of the union.
Source§

fn union(self, other: R) -> Self::Output

Returns the set union of self and other.
Source§

impl<T> Rangetools for UpperBoundedSet<T>

Source§

type Inner = UpperBoundedSet<T>

The generalized type of the range (for consolidating range types that only differ in whether their bounds are inclusive or exclusive). Read more
Source§

type Set = UpperBoundedSet<T>

The set type of the range, for talking about non-contiguous collections of elements. Read more
Source§

fn is_empty(&self) -> bool

Returns true if the range is empty. Read more
Source§

fn to_inner(self) -> Self::Inner

Convert the range to its inner type. Read more
Source§

fn to_set(self) -> Self::Set

Convert the range to its set type. Read more
Source§

fn complement<Output>(self) -> Output
where Self: Sized + RangeComplement<Output>,

Returns the complement of self (ie, the set of all elements not in self). Read more
Source§

fn intersection<R, Output>(self, other: R) -> Output
where R: Rangetools, Self: Sized + RangeIntersection<R, R::Inner, Output = Output>,

Performs set intersection on self and other. Read more
Source§

fn disjoint<R, Output>(self, other: R) -> bool
where R: Rangetools, Output: Rangetools, Self: Sized + RangeIntersection<R, R::Inner, Output = Output>,

Returns true if two sets/ranges are disjoint (they have no elements in common). Read more
Source§

fn intersects<R, Output>(self, other: R) -> bool
where R: Rangetools, Output: Rangetools, Self: Sized + RangeIntersection<R, R::Inner, Output = Output>,

Returns true if two sets/ranges intersect (they have at least one element in common). Read more
Source§

fn union<R, Output>(self, other: R) -> Output
where R: Rangetools, Self: Sized + RangeUnion<R, R::Set, Output = Output>,

Performs set union on self and other. Read more
Source§

impl<T: PartialEq> StructuralPartialEq for UpperBoundedSet<T>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.