Trait hybrid_array::FromFn

source ·
pub trait FromFn<T>: Sized {
    // Required methods
    fn from_fn<F>(cb: F) -> Self
       where F: FnMut(usize) -> T;
    fn try_from_fn<E, F>(cb: F) -> Result<Self, E>
       where F: FnMut(usize) -> Result<T, E>;
}
Expand description

Construct an array type from the given generator function.

Required Methods§

source

fn from_fn<F>(cb: F) -> Self
where F: FnMut(usize) -> T,

Create array using the given generator function for each element.

source

fn try_from_fn<E, F>(cb: F) -> Result<Self, E>
where F: FnMut(usize) -> Result<T, E>,

Create an array using the given generator function for each element, returning any errors which are encountered in the given generator.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T, const N: usize> FromFn<T> for [T; N]

source§

fn from_fn<F>(cb: F) -> Self
where F: FnMut(usize) -> T,

source§

fn try_from_fn<E, F>(cb: F) -> Result<Self, E>
where F: FnMut(usize) -> Result<T, E>,

Implementors§

source§

impl<T, U> FromFn<T> for Array<T, U>
where U: ArraySize,