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