Skip to main content

UnwrapMany

Trait UnwrapMany 

Source
pub trait UnwrapMany<const N: usize, T> {
    // Required method
    fn unwrap_many(self) -> [T; N];
}
Expand description

Helper trait for unwraping each item in an array.

§Example

let data = [Some(1), Some(2)];
let [data1, data2] = data.unwrap_many();

Required Methods§

Source

fn unwrap_many(self) -> [T; N]

Unwrap all the items in an array.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<const N: usize, T, E> UnwrapMany<N, T> for [Result<T, E>; N]
where E: Debug,

Source§

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

Implementors§