👎 Deprecated since 1.0.1:

use Itertools::at_most_one instead

Expand description

THIS CRATE IS DEPRECATED. Use Itertools::at_most_one instead.

Provides the Single trait for extracting the element from a single-element iterator.

Examples

use single::{ Single, Error };
use std::iter;

assert_eq!(iter::empty::<i32>().single(), Err(Error::NoElements));
assert_eq!(iter::once(0).single(), Ok(0));
assert_eq!(iter::repeat(0).single(), Err(Error::MultipleElements));

Enums

ErrorDeprecated

An error in the execution of Single::single.

Traits

SingleDeprecated