[−][src]Macro velcro::linked_list_from
linked_list_from!() { /* proc-macro */ }
An initializer for LinkedList
that works the same as linked_list!
except that
values can be of any type that can be converted into the collection's item
type via an Into
implementation.
The type of the item must be known at compile time, and usually this means an explicit type annotation is required.
Usage
use velcro::{linked_list, linked_list_from}; #[derive(Debug, PartialEq, Eq, Hash)] struct Foo(u64); impl From<u64> for Foo { fn from(other: u64) -> Self { Foo(other) } } let foos: LinkedList<Foo> = linked_list_from![1, 2, Foo(3), ..(4..=6), 7]; assert_eq!(foos, linked_list![Foo(1), Foo(2), Foo(3), Foo(4), Foo(5), Foo(6), Foo(7)]);