FallibleGenericSequence in generic_array::sequence - Rust

Trait FallibleGenericSequence 

Source

pub unsafe trait FallibleGenericSequence<T>: GenericSequence<T>{
    // Required method
    fn try_generate<F, E>(f: F) -> Result<Self::Sequence, E>
       where F: FnMut(usize) -> Result<T, E>;
}
Expand description

Extension to GenericSequence for fallible initialization.

§Safety

Care must be taken when implementing such that methods are safe.

Lengths must match, and element drop on panic or error must be handled.

Source

Initializes a new sequence instance using the given fallible function.

If the generator function returns an error or panics while initializing the sequence, any already initialized elements will be dropped and the error returned.

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Source§
Source§