#stream #sequence #numbers #lazily #evaluated #fibonnaci

fibonnaci-stream

Stream a Fibonnaci sequence

1 unstable release

Uses old Rust 2015

0.1.0 Feb 19, 2018

#11 in #evaluated

Apache-2.0

11KB

fibonnaci-stream

crates.io version build status downloads docs.rs docs

Stream a fibonnaci sequence.

Installation

$ cargo add fibonnaci-stream

Further Reading

License

Apache-2.0


lib.rs:

A lazily evaluated futures stream of Fibonnaci numbers.

Usage

extern crate fibonnaci_stream;

use fibonnaci_stream::{FibError, Stream};

fn main () {
  let mut stream = FibStream::new();
  stream.poll().and_then(|val| {
    assert_eq!(val, Async::Ready(Some(1)));

    stream.poll().and_then(|val| {
      assert_eq!(val, Async::Ready(Some(2)));
      Ok(())
    });

    Ok(())
  });
}

Dependencies

~2MB
~42K SLoC