pub struct Box<T: ?Sized>(/* private fields */);
Expand description
Faster alterantive for std::boxed::Box
.
Implementations§
source§impl<T> Box<T>
impl<T> Box<T>
sourcepub fn new(value: T) -> Self
pub fn new(value: T) -> Self
Allocates memory on the heap and then places x
into it.
This doesn’t actually allocate if T
is zero-sized.
§Examples
let five = Box::new(5);
Note: This is slower than using Self::new_in with cached FastAlloc.
source§impl<T: ?Sized> Box<T>
impl<T: ?Sized> Box<T>
sourcepub unsafe fn from_raw(raw: *mut T) -> Self
pub unsafe fn from_raw(raw: *mut T) -> Self
Constructs a box from a raw pointer.
After calling this function, the raw pointer is owned by the
resulting Box
. Specifically, the Box
destructor will call
the destructor of T
and free the allocated memory. For this
to be safe, the memory must have been allocated in accordance
with the memory layout used by Box
.
§Safety
This function is unsafe because improper use may lead to memory problems. For example, a double-free may occur if the function is called twice on the same raw pointer.
The safety conditions are described in the memory layout section.
§Examples
Recreate a Box
which was previously converted to a raw pointer
using Box::into_raw
:
let x = Box::new(5);
let ptr = Box::into_raw(x);
let x = unsafe { Box::from_raw(ptr) };
Manually create a Box
from scratch by using the global allocator:
use std::alloc::{alloc, Layout};
unsafe {
let ptr = alloc(Layout::new::<i32>()) as *mut i32;
// In general .write is required to avoid attempting to destruct
// the (uninitialized) previous contents of `ptr`, though for this
// simple example `*ptr = 5` would have worked as well.
ptr.write(5);
let x = Box::from_raw(ptr);
}
sourcepub fn into_raw(b: Self) -> *mut T
pub fn into_raw(b: Self) -> *mut T
Consumes the Box
, returning a wrapped raw pointer.
The pointer will be properly aligned and non-null.
After calling this function, the caller is responsible for the
memory previously managed by the Box
. In particular, the
caller should properly destroy T
and release the memory, taking
into account the memory layout used by Box
. The easiest way to
do this is to convert the raw pointer back into a Box
with the
Box::from_raw
function, allowing the Box
destructor to perform
the cleanup.
Note: this is an associated function, which means that you have
to call it as Box::into_raw(b)
instead of b.into_raw()
. This
is so that there is no conflict with a method on the inner type.
§Examples
Converting the raw pointer back into a Box
with Box::from_raw
for automatic cleanup:
let x = Box::new(String::from("Hello"));
let ptr = Box::into_raw(x);
let x = unsafe { Box::from_raw(ptr) };
Manual cleanup by explicitly running the destructor and deallocating the memory:
use std::alloc::{dealloc, Layout};
use std::ptr;
let x = Box::new(String::from("Hello"));
let ptr = Box::into_raw(x);
unsafe {
ptr::drop_in_place(ptr);
dealloc(ptr as *mut u8, Layout::new::<String>());
}
Note: This is equivalent to the following:
let x = Box::new(String::from("Hello"));
let ptr = Box::into_raw(x);
unsafe {
drop(Box::from_raw(ptr));
}
sourcepub fn into_pin(boxed: Self) -> Pin<Self>
pub fn into_pin(boxed: Self) -> Pin<Self>
Converts a Box<T>
into a Pin<Box<T>>
. If T
does not implement
Unpin
, then *boxed
will be pinned in memory and unable to be
moved.
This conversion does not allocate on the heap and happens in place.
This is also available via From
.
Constructing and pinning a Box
with
Box::into_pin(Box::new(x))
can also be written more
concisely using [Box::pin](x)
. This into_pin
method
is useful if you already have a Box<T>
, or you are constructing a
(pinned) Box
in a different way than with Box::new
.
§Notes
It’s not recommended that crates add an impl like From<Box<T>> for Pin<T>
, as it’ll introduce an ambiguity when calling Pin::from
.
A demonstration of such a poor impl is shown below.
struct Foo; // A type defined in this crate.
impl From<Box<()>> for Pin<Foo> {
fn from(_: Box<()>) -> Pin<Foo> {
Pin::new(Foo)
}
}
let foo = Box::new(());
let bar = Pin::from(foo);
Trait Implementations§
source§impl<T: ArchiveUnsized + ?Sized> Archive for Box<T>
impl<T: ArchiveUnsized + ?Sized> Archive for Box<T>
source§type Archived = ArchivedBox<<T as ArchiveUnsized>::Archived>
type Archived = ArchivedBox<<T as ArchiveUnsized>::Archived>
source§type Resolver = BoxResolver<<T as ArchiveUnsized>::MetadataResolver>
type Resolver = BoxResolver<<T as ArchiveUnsized>::MetadataResolver>
source§impl<T: ?Sized> BorrowMut<T> for Box<T>
impl<T: ?Sized> BorrowMut<T> for Box<T>
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T: ?Sized + BufRead> BufRead for Box<T>
impl<T: ?Sized + BufRead> BufRead for Box<T>
source§fn fill_buf(&mut self) -> Result<&[u8]>
fn fill_buf(&mut self) -> Result<&[u8]>
source§fn consume(&mut self, amt: usize)
fn consume(&mut self, amt: usize)
amt
bytes have been consumed from the buffer,
so they should no longer be returned in calls to read
. Read moresource§fn has_data_left(&mut self) -> Result<bool, Error>
fn has_data_left(&mut self) -> Result<bool, Error>
buf_read_has_data_left
)Read
has any data left to be read. Read more1.83.0 · source§fn skip_until(&mut self, byte: u8) -> Result<usize, Error>
fn skip_until(&mut self, byte: u8) -> Result<usize, Error>
byte
or EOF is reached. Read more1.0.0 · source§fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>
0xA
byte) is reached, and append
them to the provided String
buffer. Read moresource§impl<'de, T> Deserialize<'de> for Box<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for Box<T>where
T: Deserialize<'de>,
source§fn deserialize<D>(deserializer: D) -> Result<Box<T>, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Box<T>, D::Error>where
D: Deserializer<'de>,
source§impl<T, D> Deserialize<Box<T>, D> for ArchivedBox<T::Archived>
impl<T, D> Deserialize<Box<T>, D> for ArchivedBox<T::Archived>
source§impl<T> DoubleEndedIterator for Box<T>where
T: DoubleEndedIterator + ?Sized,
impl<T> DoubleEndedIterator for Box<T>where
T: DoubleEndedIterator + ?Sized,
source§fn next_back(&mut self) -> Option<Self::Item>
fn next_back(&mut self) -> Option<Self::Item>
source§fn nth_back(&mut self, n: usize) -> Option<Self::Item>
fn nth_back(&mut self, n: usize) -> Option<Self::Item>
n
th element from the end of the iterator. Read moresource§fn rfold<B, F>(self, init: B, f: F) -> B
fn rfold<B, F>(self, init: B, f: F) -> B
source§fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
source§impl<T> ExactSizeIterator for Box<T>where
T: ?Sized + ExactSizeIterator,
impl<T> ExactSizeIterator for Box<T>where
T: ?Sized + ExactSizeIterator,
source§impl<T> Iterator for Box<T>
impl<T> Iterator for Box<T>
source§fn next(&mut self) -> Option<Self::Item>
fn next(&mut self) -> Option<Self::Item>
source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
source§fn count(self) -> usize
fn count(self) -> usize
source§fn last(self) -> Option<Self::Item>
fn last(self) -> Option<Self::Item>
source§fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read moresource§fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
source§fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
source§fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
source§fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
source§fn collect<B>(self) -> Bwhere
B: FromIterator<Self::Item>,
fn collect<B>(self) -> Bwhere
B: FromIterator<Self::Item>,
source§fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
source§fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
source§fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
source§fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
source§fn max_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>
source§fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
source§fn min_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B: Ord, F>(self, f: F) -> Option<Self::Item>
source§fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
source§fn product<P>(self) -> P
fn product<P>(self) -> P
source§fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of
this Iterator
with those of another. The comparison works like short-circuit
evaluation, returning a result without comparing the remaining elements.
As soon as an order can be determined, the evaluation stops and a result is returned. Read moresource§fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically
less than those of another. Read moresource§fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically
less or equal to those of another. Read moresource§fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than those of another. Read moresource§fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than or equal to those of another. Read moresource§fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
iter_next_chunk
)N
values. Read moresource§fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
)n
elements. Read more1.28.0 · source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
1.0.0 · source§fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
1.0.0 · source§fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
source§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
)separator
between adjacent items of the original iterator. Read more1.0.0 · source§fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.0.0 · source§fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 · source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 · source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
1.0.0 · source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 · source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 · source§fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 · source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
elements. Read more1.0.0 · source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
elements, or fewer
if the underlying iterator ends sooner. Read more1.0.0 · source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
source§fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
iter_map_windows
)f
for each contiguous window of size N
over
self
and returns an iterator over the outputs of f
. Like slice::windows()
,
the windows during mapping overlap as well. Read more1.0.0 · source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
source§fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
)source§fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
)true
precede all those that return false
. Read more1.27.0 · source§fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
1.27.0 · source§fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
source§fn try_reduce<R>(
&mut self,
f: impl FnMut(Self::Item, Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>( &mut self, f: impl FnMut(Self::Item, Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
)source§fn try_find<R>(
&mut self,
f: impl FnMut(&Self::Item) -> R,
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>( &mut self, f: impl FnMut(&Self::Item) -> R, ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
)1.0.0 · source§fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 · source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
source§fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
iter_array_chunks
)N
elements of the iterator at a time. Read moresource§fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read moresource§fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read moresource§fn eq_by<I, F>(self, other: I, eq: F) -> bool
fn eq_by<I, F>(self, other: I, eq: F) -> bool
iter_order_by
)1.82.0 · source§fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 · source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
source§impl<T: Ord + ?Sized> Ord for Box<T>
impl<T: Ord + ?Sized> Ord for Box<T>
source§impl<T: ArchivePointee + PartialEq<U> + ?Sized, U: ?Sized> PartialEq<Box<U>> for ArchivedBox<T>
impl<T: ArchivePointee + PartialEq<U> + ?Sized, U: ?Sized> PartialEq<Box<U>> for ArchivedBox<T>
source§impl<T: ArchivePointee + PartialOrd<U> + ?Sized, U: ?Sized> PartialOrd<Box<U>> for ArchivedBox<T>
impl<T: ArchivePointee + PartialOrd<U> + ?Sized, U: ?Sized> PartialOrd<Box<U>> for ArchivedBox<T>
source§impl<T: PartialOrd + ?Sized> PartialOrd for Box<T>
impl<T: PartialOrd + ?Sized> PartialOrd for Box<T>
source§impl<T> Read for Box<T>
impl<T> Read for Box<T>
source§fn read(&mut self, buf: &mut [u8]) -> Result<usize>
fn read(&mut self, buf: &mut [u8]) -> Result<usize>
source§fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize>
buf
. Read moresource§fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
fn read_to_string(&mut self, buf: &mut String) -> Result<usize>
buf
. Read moresource§fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
fn read_exact(&mut self, buf: &mut [u8]) -> Result<()>
buf
. Read more1.36.0 · source§fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>
read
, except that it reads into a slice of buffers. Read moresource§fn is_read_vectored(&self) -> bool
fn is_read_vectored(&self) -> bool
can_vector
)source§fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf(&mut self, buf: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)source§fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>
read_buf
)cursor
. Read more1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Read
. Read moresource§impl<T> Seek for Box<T>
impl<T> Seek for Box<T>
source§fn seek(&mut self, pos: SeekFrom) -> Result<u64>
fn seek(&mut self, pos: SeekFrom) -> Result<u64>
1.55.0 · source§fn rewind(&mut self) -> Result<(), Error>
fn rewind(&mut self) -> Result<(), Error>
source§fn stream_len(&mut self) -> Result<u64, Error>
fn stream_len(&mut self) -> Result<u64, Error>
seek_stream_len
)source§impl<T> Write for Box<T>
impl<T> Write for Box<T>
source§impl<T> Write for Box<T>
impl<T> Write for Box<T>
source§fn write(&mut self, buf: &[u8]) -> Result<usize>
fn write(&mut self, buf: &[u8]) -> Result<usize>
source§fn flush(&mut self) -> Result<()>
fn flush(&mut self) -> Result<()>
source§fn write_all(&mut self, buf: &[u8]) -> Result<()>
fn write_all(&mut self, buf: &[u8]) -> Result<()>
source§fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>
fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<()>
source§fn is_write_vectored(&self) -> bool
fn is_write_vectored(&self) -> bool
can_vector
)impl<T: Eq + ?Sized> Eq for Box<T>
impl<T> FusedIterator for Box<T>where
T: ?Sized + FusedIterator,
impl<T: ?Sized> StructuralPartialEq for Box<T>
Auto Trait Implementations§
impl<T> Freeze for Box<T>where
T: ?Sized,
impl<T> !RefUnwindSafe for Box<T>
impl<T> !Send for Box<T>
impl<T> !Sync for Box<T>
impl<T> Unpin for Box<T>where
T: ?Sized,
impl<T> !UnwindSafe for Box<T>
Blanket Implementations§
source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive
, it may be unsized. Read moresource§type MetadataResolver = ()
type MetadataResolver = ()
source§unsafe fn resolve_metadata(
&self,
_: usize,
_: <T as ArchiveUnsized>::MetadataResolver,
_: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata,
)
unsafe fn resolve_metadata( &self, _: usize, _: <T as ArchiveUnsized>::MetadataResolver, _: *mut <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata, )
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CallHasher for T
impl<T> CallHasher for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<I> CollectIn for Iwhere
I: Iterator,
impl<I> CollectIn for Iwhere
I: Iterator,
source§fn collect_in<C>(self, alloc: <C as FromIteratorIn<Self::Item>>::Alloc) -> Cwhere
C: FromIteratorIn<Self::Item>,
fn collect_in<C>(self, alloc: <C as FromIteratorIn<Self::Item>>::Alloc) -> Cwhere
C: FromIteratorIn<Self::Item>,
Iterator::collect
. Read more