Struct MultiVec

Source
pub struct MultiVec<T, const D: usize> { /* private fields */ }
Expand description

A multi-dimensional vector. This is faster and simpler than using Vec<Vec<…>>

Implementations§

Source§

impl<T: Copy, const D: usize> MultiVec<T, D>

Source

pub fn fill(axes: [usize; D], value: T) -> Self

Constructs a MultiVec with the specified axes and fills it with the specified value.

Source§

impl<T, const D: usize> MultiVec<T, D>

Source

pub fn new(axes: [usize; D]) -> Self

Constructs a MultiVec with the specified axes.

Source

pub fn fill_fn(axes: [usize; D], f: impl Fn(usize) -> T) -> Self

Constructs a MultiVec with the specified axes and fills it with the result of the function.

Source

pub fn iso(&mut self, new_axes: [usize; D])

Performs an isomorphism on the axes. The new axes must have the same number of elements.

Source

pub fn iter(&self) -> impl Iterator<Item = &T>

Returns an iterator over references to the elements.

Source

pub fn iter_mut(&mut self) -> impl Iterator<Item = &mut T>

Returns an iterator over mutable references to the elements.

Source

pub fn len(&self) -> usize

Returns the number of elements.

Source

pub fn is_empty(&self) -> bool

Returns true if the MultiVec is empty.

Source§

impl<T> MultiVec<T, 2>

Source

pub fn to_vec(self) -> Vec<T>

Converts the MultiVec to a Vec.

Trait Implementations§

Source§

impl<T, const D: usize> AsMut<[T]> for MultiVec<T, D>

Source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T, const D: usize> AsRef<[T]> for MultiVec<T, D>

Source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Clone, const D: usize> Clone for MultiVec<T, D>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, const D: usize> Debug for MultiVec<T, D>

Source§

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

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

impl<T, const D: usize> Default for MultiVec<T, D>

Source§

fn default() -> Self

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

impl<T: Hash, const D: usize> Hash for MultiVec<T, D>

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> Index<(usize, Range<usize>)> for MultiVec<T, 2>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, (i, j): (usize, Range<usize>)) -> &[T]

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<(usize, RangeFrom<usize>)> for MultiVec<T, 2>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, (i, j): (usize, RangeFrom<usize>)) -> &[T]

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<(usize, RangeFull)> for MultiVec<T, 2>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, (i, _): (usize, RangeFull)) -> &[T]

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<(usize, RangeInclusive<usize>)> for MultiVec<T, 2>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, (i, j): (usize, RangeInclusive<usize>)) -> &[T]

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<(usize, RangeTo<usize>)> for MultiVec<T, 2>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, (i, j): (usize, RangeTo<usize>)) -> &[T]

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<(usize, RangeToInclusive<usize>)> for MultiVec<T, 2>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, (i, j): (usize, RangeToInclusive<usize>)) -> &[T]

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<(usize, usize)> for MultiVec<T, 2>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, (i, j): (usize, usize)) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<usize> for MultiVec<T, 2>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, i: usize) -> &[T]

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<(usize, Range<usize>)> for MultiVec<T, 2>

Source§

fn index_mut(&mut self, (i, j): (usize, Range<usize>)) -> &mut [T]

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<(usize, RangeFrom<usize>)> for MultiVec<T, 2>

Source§

fn index_mut(&mut self, (i, j): (usize, RangeFrom<usize>)) -> &mut [T]

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<(usize, RangeFull)> for MultiVec<T, 2>

Source§

fn index_mut(&mut self, (i, _): (usize, RangeFull)) -> &mut [T]

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<(usize, RangeInclusive<usize>)> for MultiVec<T, 2>

Source§

fn index_mut(&mut self, (i, j): (usize, RangeInclusive<usize>)) -> &mut [T]

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<(usize, RangeTo<usize>)> for MultiVec<T, 2>

Source§

fn index_mut(&mut self, (i, j): (usize, RangeTo<usize>)) -> &mut [T]

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<(usize, RangeToInclusive<usize>)> for MultiVec<T, 2>

Source§

fn index_mut(&mut self, (i, j): (usize, RangeToInclusive<usize>)) -> &mut [T]

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<(usize, usize)> for MultiVec<T, 2>

Source§

fn index_mut(&mut self, (i, j): (usize, usize)) -> &mut T

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<usize> for MultiVec<T, 2>

Source§

fn index_mut(&mut self, i: usize) -> &mut [T]

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T: Ord, const D: usize> Ord for MultiVec<T, D>

Source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl<T: PartialEq, const D: usize> PartialEq for MultiVec<T, D>

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd, const D: usize> PartialOrd for MultiVec<T, D>

Source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<T: Zeroize, const D: usize> Zeroize for MultiVec<T, D>

Source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.
Source§

impl<T: Eq, const D: usize> Eq for MultiVec<T, D>

Auto Trait Implementations§

§

impl<T, const D: usize> Freeze for MultiVec<T, D>

§

impl<T, const D: usize> RefUnwindSafe for MultiVec<T, D>
where T: RefUnwindSafe,

§

impl<T, const D: usize> Send for MultiVec<T, D>
where T: Send,

§

impl<T, const D: usize> Sync for MultiVec<T, D>
where T: Sync,

§

impl<T, const D: usize> Unpin for MultiVec<T, D>
where T: Unpin,

§

impl<T, const D: usize> UnwindSafe for MultiVec<T, D>
where T: UnwindSafe,

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, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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<I, S, B> ReadableShareSet<I, S> for B
where I: ShareIdentifier, S: Share<Identifier = I>, B: AsRef<[S]>,

Source§

fn combine_to_field_element<F, C>(&self) -> Result<F, Error>
where F: PrimeField, C: ShareSetCombiner<I, S, F, F>,

Convert the given shares into a field element
Source§

fn combine_to_group_element<G, C>(&self) -> Result<G, Error>
where G: Group + GroupEncoding + Default, C: ShareSetCombiner<I, S, <G as Group>::Scalar, G>,

Convert the given shares into a group element
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToHex for T
where T: AsRef<[u8]>,

Source§

fn encode_hex<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca)
Source§

fn encode_hex_upper<U>(&self) -> U
where U: FromIterator<char>,

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA)
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V