Trait zkgroup::common::array_utils::ArrayLike

source ·
pub trait ArrayLike<T>: Index<usize, Output = T> {
    const LEN: usize;

    // Required methods
    fn create(create_element: impl FnMut() -> T) -> Self;
    fn iter(&self) -> Iter<'_, T>;
}
Expand description

Abstracts over fixed-length arrays (and similar types) with an element type T.

Provides iter and Index rather than Deref or AsRef<[T]> to allow for alternate forms of indexing, for which exposing a slice could be confusing. See OneBased.

Required Associated Constants§

Required Methods§

source

fn create(create_element: impl FnMut() -> T) -> Self

source

fn iter(&self) -> Iter<'_, T>

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, const LEN: usize> ArrayLike<T> for [T; LEN]

source§

const LEN: usize = LEN

source§

fn create(create_element: impl FnMut() -> T) -> Self

source§

fn iter(&self) -> Iter<'_, T>

Implementors§

source§

impl<T, Ts> ArrayLike<T> for OneBased<Ts>
where Ts: ArrayLike<T>,

source§

const LEN: usize = Ts::LEN