[][src]Struct iter_num_tools::Arange

pub struct Arange<F> { /* fields omitted */ }

Iterator over a range, stepping by a fixed amount each time

Implementations

impl<F> Arange<F> where
    F: Zero
[src]

pub fn new(range: Range<F>, step: F) -> Self[src]

Create a new iterator over the range, stepping by step each time This allows you to create simple float iterators

use iter_num_tools::Arange;
use itertools::Itertools;

let it = Arange::new(0.0..2.0, 0.5);
itertools::assert_equal(it, vec![0.0, 0.5, 1.0, 1.5])

Arange isn't perfect, you might want lin_space if step isn't 'whole' float

use iter_num_tools::{Arange, lin_space};
use itertools::Itertools;

// With Arange, you get some accuracy loss
let it = Arange::new(0.0..0.5, 0.1);
itertools::assert_equal(it, vec![0.0, 0.1, 0.2, 0.30000000000000004, 0.4]);

let it = lin_space(0.0..0.5, 5);
itertools::assert_equal(it, vec![0.0, 0.1, 0.2, 0.3, 0.4]);

Trait Implementations

impl<F: Clone> Clone for Arange<F>[src]

impl<F: Copy> Copy for Arange<F>[src]

impl<F> Iterator for Arange<F> where
    F: Float + AddAssign + Sub<Output = F> + Div<Output = F> + ToPrimitive + One
[src]

type Item = F

The type of the elements being iterated over.

Auto Trait Implementations

impl<F> RefUnwindSafe for Arange<F> where
    F: RefUnwindSafe
[src]

impl<F> Send for Arange<F> where
    F: Send
[src]

impl<F> Sync for Arange<F> where
    F: Sync
[src]

impl<F> Unpin for Arange<F> where
    F: Unpin
[src]

impl<F> UnwindSafe for Arange<F> where
    F: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<T> Itertools for T where
    T: Iterator + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.