Skip to main content

Set

Enum Set 

Source
pub enum Set {
    Range(Vec<i64>),
    Strings(Vec<String>),
    Tuples(Vec<IndexTuple>),
}
Expand description

A finite, ordered index set.

Supports integer ranges, string lists, and arbitrary tuple lists (built via Set::product / the &a * &b operator, or constructed directly).

Variants§

§

Range(Vec<i64>)

§

Strings(Vec<String>)

§

Tuples(Vec<IndexTuple>)

Implementations§

Source§

impl Set

Source

pub fn range<T: PrimInt>(r: Range<T>) -> Self

Build an integer index set from a range over any primitive integer type. Accepts Range<i64>, Range<i32>, Range<usize>, etc.

The untyped literal form Set::range(0..5) defaults to i32 and works without annotation.

§Panics

Panics if either range bound does not fit in i64.

Source

pub fn from_ints<T, I>(iter: I) -> Self
where T: PrimInt, I: IntoIterator<Item = T>,

Build an integer index set from an iterator of any primitive integer type. Useful when keys are sparse or computed (e.g. only even indices).

§Panics

Panics if any element does not fit in i64.

Source

pub fn strings<I, S>(iter: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Source

pub fn tuples<I, T>(iter: I) -> Self
where I: IntoIterator<Item = T>, T: Into<IndexTuple>,

Build a tuple set directly from an iterator of keys.

Source

pub fn product(a: &Set, b: &Set) -> Self

Cartesian product of two sets. Inner tuple keys are flattened so a product (a * b) * c yields 3-element tuples, not nested 2-tuples.

Source

pub fn filter<F>(&self, f: F) -> Self
where F: FnMut(&IndexKey) -> bool,

Filter keys with a predicate. Preserves the original variant where possible, filtered Range/Strings stay in their native variant.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source§

impl Set

Source

pub fn iter(&self) -> SetIter<'_>

Source

pub fn par_iter(&self) -> impl ParallelIterator<Item = IndexKey> + '_

Trait Implementations§

Source§

impl Clone for Set

Source§

fn clone(&self) -> Set

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 Debug for Set

Source§

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

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

impl<'a> IntoIterator for &'a Set

Source§

type Item = IndexKey

The type of the elements being iterated over.
Source§

type IntoIter = SetIter<'a>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl Mul<&Set> for &Set

Source§

type Output = Set

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Set) -> Set

Performs the * operation. Read more

Auto Trait Implementations§

§

impl Freeze for Set

§

impl RefUnwindSafe for Set

§

impl Send for Set

§

impl Sync for Set

§

impl Unpin for Set

§

impl UnsafeUnpin for Set

§

impl UnwindSafe for Set

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.