Crate single[−][src]
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
Error |
An error in the execution of |
Traits
Single |