pub trait CollectionExt<T>: Sizedwhere
    T: IntoIterator,
{ fn into_first(self) -> T::Item; fn into_last(self) -> T::Item; fn expect_element<Err: Display>(self, msg: Err) -> T::Item; fn into_element(self) -> T::Item { ... } }
Expand description

Extension methods for collections.

Required Methods

Consumes the collection and returns its first element.

This method panics if the collection does not have at least one element.

Consumes the collection and returns its last element.

This method panics if the collection does not have at least one element.

Consumes the collection and returns its only element.

This method panics with the given error message if the collection does not have exactly one element.

Provided Methods

Consumes the collection and returns its only element.

This method panics if the collection does not have exactly one element.

Implementors