pub trait TryExtend<T> {
    type Error;

    // Required method
    fn try_extend<I: IntoIterator<Item = T>>(
        &mut self,
        iter: I
    ) -> Result<(), Self::Error>;

    // Provided method
    fn try_extend_one(&mut self, item: T) -> Result<(), Self::Error> { ... }
}
Expand description

Fallible variant of the Extend trait

Required Associated Types§

source

type Error

The type returned in the event of an error.

Required Methods§

source

fn try_extend<I: IntoIterator<Item = T>>( &mut self, iter: I ) -> Result<(), Self::Error>

Tries to extends a collection with the contents of an iterator.

Provided Methods§

source

fn try_extend_one(&mut self, item: T) -> Result<(), Self::Error>

Tries to extend a collection with exactly one element.

Implementors§