single 0.2.0

This crate exposes a trait "single::Single" for extracting the element from a single-element iterator.
Documentation
# Single

[![Build Status](https://img.shields.io/travis/CAD97/rust-single.svg)](https://travis-ci.org/CAD97/rust-single)
[![crates.io](https://img.shields.io/crates/v/single.svg)](https://crates.io/crates/single)
[![downloads](https://img.shields.io/crates/d/single.svg)](https://crates.io/crates/single)
[![version downloads](https://img.shields.io/crates/dv/single.svg)](https://crates.io/crates/single)
[![issues open](https://img.shields.io/github/issues/CAD97/rust-single.svg)](https://github.com/CAD97/rust-single/issues)
![issues closed](https://img.shields.io/github/issues-closed/CAD97/rust-single.svg)

This crate exposes a `Single` trait for extracting the element from a single-element iterator.

## License


You may use this crate under the MIT license or the Apache License (Version 2)
at your discretion. This crate is dual-licensed for compatibility with rust itself.

## Trait single::Single


```rust
pub trait Single {
    type Item;
    fn single(self) -> Result<Self::Item, Error>;
}
```

### Associated Types


<dl>
  <dt><code>type Item</code>
  <dd><p>The item type of the wrapped iterator.
</dl>

### Required Methods


<dl>
  <dt><code>fn single(self) -> Result&lt;Self::Item, Error&gt;</code>
  <dd>
    <p>Get the single element from a single-element iterator.
    <p>Note that many iterators return references to the elements, so this method will as well if the backing iterator does.
    <h4>Examples</h4>
<pre>assert_eq!(iter::empty::<i32>().single(), Err(single::Error::NoElements));
assert_eq!(iter::once(0).single(), Ok(0));
assert_eq!(iter::repeat(0).single(), Err(single::Error::MultipleElements));</pre>
</dl>

### Implementors


```rust
impl<I> Single for I
  where I: Iterator
```