fib_sequence/
lib.rs

1//! # Smol Fibonacci Sequence Library
2//! 
3//! There is, quite honestly, no need for documentation. Everything you need to know is in the
4//! readme file, but here is a brief summary:
5//! 
6//! * Running through the sequence
7//! 
8//! The [Sequence] struct is an iterator:
9//! 
10//! ```
11//! use fib_sequence::Sequence;
12//! for n in Sequence::new() { ... }
13//! ```
14//! 
15//! Just be careful, it's an infinite iterator. So make sure to use something like the
16//! [take](std::iter::Iterator::take) method to make it finite.
17//! 
18//! It returns a string representation of the number in base 10. Simply because that's what this
19//! library is meant for. Retrieving big fibonacci numbers in decimal.
20//! 
21//! * The [nth] function
22//! 
23//! It returns the nth fibonacci number. Please use this if you want to retrieve one or a few
24//! numbers, as iterating through a sequence is much slower.
25//! 
26//! Produces a string, for the same reason as above.
27//! 
28//! ```
29//! println!("{}", fib_sequence::nth(10_000));
30//! ```
31//! 
32//! That's it.
33
34mod arithmetic;
35
36pub use fibonacci::{FibonacciSequence as Sequence, nth};
37mod fibonacci;
38
39#[cfg(test)]
40mod tests {
41    #[test]
42    fn nth() {
43        println!("{}", super::nth(1_000_000));
44    }
45}