Macro velcro::iter_from

source ·
iter_from!() { /* proc-macro */ }
Expand description

Creates an iterator, over the given values. Works the same as iter except that values may be any type that can be converted to the iterator item type via an Into implementation.

Usage

use velcro::iter;

#[derive(Debug, PartialEq)]
struct Foo(u64);

impl From<u64> for Foo {
    fn from(other: u64) -> Self {
        Foo(other)
    }
}

assert_eq!(iter![0, 1, ..(2..=5), 6].collect::<Vec<_>>(), vec![0, 1, 2, 3, 4, 5, 6]);