devela::_dep::bumpalo::collections

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

The allocator type

Required Methods§

fn from_iter_in<I>(iter: I, alloc: Self::Alloc) -> Self
where 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.

Implementors§

§

impl<'bump> FromIteratorIn<char> for String<'bump>

§

type Alloc = &'bump Bump

§

impl<'bump, T> FromIteratorIn<T> for Box<'bump, [T]>

§

type Alloc = &'bump Bump

§

impl<'bump, T> FromIteratorIn<T> for Vec<'bump, T>

§

type Alloc = &'bump Bump

§

impl<T, E, V> FromIteratorIn<Result<T, E>> for Result<V, E>
where V: FromIteratorIn<T>,

§

type Alloc = <V as FromIteratorIn<T>>::Alloc

§

impl<T, V> FromIteratorIn<Option<T>> for Option<V>
where V: FromIteratorIn<T>,

§

type Alloc = <V as FromIteratorIn<T>>::Alloc