Trait FromIteratorIn
pub trait FromIteratorIn<A> {
type Alloc;
// Required method
fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Self
where I: IntoIterator<Item = A>;
}
Available on crate feature
dep_bumpalo
only.Expand description
A trait for types that support being constructed from an iterator, parameterized by an allocator.
Required Associated Types§
type Alloc
type Alloc
The allocator type
Required Methods§
fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Selfwhere
I: IntoIterator<Item = A>,
fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Selfwhere
I: IntoIterator<Item = A>,
Similar to FromIterator::from_iter
, but with a given allocator.
let five_fives = std::iter::repeat(5).take(5);
let bump = Bump::new();
let v = Vec::from_iter_in(five_fives, &bump);
assert_eq!(v, [5, 5, 5, 5, 5]);
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.