pub unsafe fn alloc(layout: Layout) -> *mut u8
Expand description
Allocates memory with the global allocator.
\n+pub unsafe fn alloc(layout: Layout) -> *mut u8
Expand description
Allocates memory with the global allocator.
\nThis function forwards calls to the GlobalAlloc::alloc
method\n of the allocator registered with the #[global_allocator]
attribute\n if there is one, or the std
crate\u2019s default.
This function is expected to be deprecated in favor of the allocate
method\n of the Global
type when it and the Allocator
trait become stable.
\u00a7Safety
\nSee GlobalAlloc::alloc
.
pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8
Expand description
Allocates zero-initialized memory with the global allocator.
\n+pub unsafe fn alloc_zeroed(layout: Layout) -> *mut u8
Expand description
Allocates zero-initialized memory with the global allocator.
\nThis function forwards calls to the GlobalAlloc::alloc_zeroed
method\n of the allocator registered with the #[global_allocator]
attribute\n if there is one, or the std
crate\u2019s default.
This function is expected to be deprecated in favor of the allocate_zeroed
method\n of the Global
type when it and the Allocator
trait become stable.
\u00a7Safety
\nSee GlobalAlloc::alloc_zeroed
.
pub unsafe fn dealloc(ptr: *mut u8, layout: Layout)
Expand description
Deallocates memory with the global allocator.
\n+pub unsafe fn dealloc(ptr: *mut u8, layout: Layout)
Expand description
Deallocates memory with the global allocator.
\nThis function forwards calls to the GlobalAlloc::dealloc
method\n of the allocator registered with the #[global_allocator]
attribute\n if there is one, or the std
crate\u2019s default.
This function is expected to be deprecated in favor of the deallocate
method\n of the Global
type when it and the Allocator
trait become stable.
\u00a7Safety
\nSee GlobalAlloc::dealloc
.
pub fn handle_alloc_error(layout: Layout) -> !
Expand description
Signals a memory allocation error.
\n+pub fn handle_alloc_error(layout: Layout) -> !
Expand description
Signals a memory allocation error.
\nCallers of memory allocation APIs wishing to cease execution\n in response to an allocation error are encouraged to call this function,\n-rather than directly invoking panic!
or similar.
panic!
or similar.\n This function is guaranteed to diverge (not return normally with a value), but depending on\n global configuration, it may either panic (resulting in unwinding or aborting as per\n configuration for all panics), or abort the process (with no unwinding).
\nThe default behavior is:
\n- \n
- \n
If the binary links against
\nstd
(typically the case), then\n print a message to standard error and abort the process.\n This behavior can be replaced withset_alloc_error_hook
andtake_alloc_error_hook
.\n Future versions of Rust may panic by default instead. \n - \n
If the binary does not link against
\nstd
(all of its crates are marked\n-#![no_std]
), then callpanic!
with a message.\n+#![no_std]
), then callpanic!
with a message.\n The panic handler applies as to any panic. \n
pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
Expand description
Reallocates memory with the global allocator.
\n+pub unsafe fn realloc(ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8
Expand description
Reallocates memory with the global allocator.
\nThis function forwards calls to the GlobalAlloc::realloc
method\n of the allocator registered with the #[global_allocator]
attribute\n if there is one, or the std
crate\u2019s default.
This function is expected to be deprecated in favor of the grow
and shrink
methods\n of the Global
type when it and the Allocator
trait become stable.
\u00a7Safety
\nSee GlobalAlloc::realloc
.
pub struct AllocError;
allocator_api
#32838)Expand description
The AllocError
error indicates an allocation failure\n+
pub struct AllocError;
allocator_api
#32838)Expand description
The AllocError
error indicates an allocation failure\n that may be due to resource exhaustion or to\n something wrong when combining the given input arguments with this\n allocator.
Trait Implementations\u00a7
Source\u00a7impl Clone for AllocError
impl Clone for AllocError
Source\u00a7fn clone(&self) -> AllocError
fn clone(&self) -> AllocError
1.0.0 \u00b7 Source\u00a7fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource\u00a7impl Debug for AllocError
impl Debug for AllocError
Source\u00a7impl Display for AllocError
impl Display for AllocError
Source\u00a7impl Error for AllocError
impl Error for AllocError
1.30.0 \u00b7 Source\u00a7fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 \u00b7 Source\u00a7fn description(&self) -> &str
fn description(&self) -> &str
Source\u00a7impl PartialEq for AllocError
impl PartialEq for AllocError
impl Copy for AllocError
impl Eq for AllocError
impl StructuralPartialEq for AllocError
Auto Trait Implementations\u00a7
impl Freeze for AllocError
impl RefUnwindSafe for AllocError
impl Send for AllocError
impl Sync for AllocError
impl Unpin for AllocError
impl UnwindSafe for AllocError
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
impl<T, U> Into<U> for Twhere\n- U: From<T>,
Trait Implementations\u00a7
Source\u00a7impl Clone for AllocError
impl Clone for AllocError
Source\u00a7fn clone(&self) -> AllocError
fn clone(&self) -> AllocError
1.0.0 \u00b7 Source\u00a7fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource\u00a7impl Debug for AllocError
impl Debug for AllocError
Source\u00a7impl Display for AllocError
impl Display for AllocError
Source\u00a7impl Error for AllocError
impl Error for AllocError
1.30.0 \u00b7 Source\u00a7fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 \u00b7 Source\u00a7fn description(&self) -> &str
fn description(&self) -> &str
Source\u00a7impl PartialEq for AllocError
impl PartialEq for AllocError
impl Copy for AllocError
impl Eq for AllocError
impl StructuralPartialEq for AllocError
Auto Trait Implementations\u00a7
impl Freeze for AllocError
impl RefUnwindSafe for AllocError
impl Send for AllocError
impl Sync for AllocError
impl Unpin for AllocError
impl UnwindSafe for AllocError
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7fn to_owned(&self) -> T
fn to_owned(&self) -> T
Source\u00a7fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
pub struct Global;
allocator_api
#32838)Expand description
The global memory allocator.
\nThis type implements the Allocator
trait by forwarding calls\n to the allocator registered with the #[global_allocator]
attribute\n if there is one, or the std
crate\u2019s default.
Note: while this type is unstable, the functionality it provides can be\n accessed through the free functions in alloc
.
Trait Implementations\u00a7
Source\u00a7impl Allocator for Global
impl Allocator for Global
Source\u00a7fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocator_api
#32838)Source\u00a7fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocator_api
#32838)allocate
, but also ensures that the returned memory is zero-initialized. Read moreTrait Implementations\u00a7
Source\u00a7impl Allocator for Global
impl Allocator for Global
Source\u00a7fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocator_api
#32838)Source\u00a7fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
fn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
allocator_api
#32838)allocate
, but also ensures that the returned memory is zero-initialized. Read moreSource\u00a7unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
allocator_api
#32838)ptr
. Read moreSource\u00a7unsafe fn grow(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n-) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n-) -> Result<NonNull<[u8]>, AllocError>
allocator_api
#32838)Source\u00a7unsafe fn grow_zeroed(\n+) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed(\n+) -> Result<NonNull<[u8]>, AllocError>
allocator_api
#32838)Source\u00a7unsafe fn grow_zeroed(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n-) -> Result<NonNull<[u8]>, AllocError>
unsafe fn grow_zeroed(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n-) -> Result<NonNull<[u8]>, AllocError>
allocator_api
#32838)grow
, but also ensures that the new contents are set to zero before being\n+) -> Result<NonNull<[u8]>, AllocError>allocator_api
#32838)grow
, but also ensures that the new contents are set to zero before being\n returned. Read moreimpl Copy for Global
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global>
Auto Trait Implementations\u00a7
impl Freeze for Global
impl RefUnwindSafe for Global
impl Send for Global
impl Sync for Global
impl Unpin for Global
impl UnwindSafe for Global
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
impl<T, U> Into<U> for Twhere\n- U: From<T>,
Source\u00a7fn into(self) -> U
fn into(self) -> U
impl Copy for Global
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global>
Auto Trait Implementations\u00a7
impl Freeze for Global
impl RefUnwindSafe for Global
impl Send for Global
impl Sync for Global
impl Unpin for Global
impl UnwindSafe for Global
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7fn to_owned(&self) -> T
fn to_owned(&self) -> T
Source\u00a7fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
pub struct Layout { /* private fields */ }
Expand description
Layout of a block of memory.
\n+pub struct Layout { /* private fields */ }
Expand description
Layout of a block of memory.
\nAn instance of Layout
describes a particular layout of memory.\n You build a Layout
up as an input to give to an allocator.
All layouts have an associated size and a power-of-two alignment. The size, when rounded up to\n the nearest multiple of align
, does not overflow isize
(i.e., the rounded value will always be\n less than or equal to isize::MAX
).
(Note that layouts are not required to have non-zero size,\n even though GlobalAlloc
requires that all memory requests\n be non-zero in size. A caller must either ensure that conditions\n like this are met, use specific allocators with looser\n requirements, or use the more lenient Allocator
interface.)
Implementations\u00a7
Source\u00a7impl Layout
impl Layout
1.28.0 (const: 1.50.0) \u00b7 Sourcepub const fn from_size_align(\n- size: usize,\n- align: usize,\n-) -> Result<Layout, LayoutError>
pub const fn from_size_align(\n- size: usize,\n- align: usize,\n-) -> Result<Layout, LayoutError>
Constructs a Layout
from a given size
and align
,\n+
Implementations\u00a7
Source\u00a7impl Layout
impl Layout
1.28.0 (const: 1.50.0) \u00b7 Sourcepub const fn from_size_align(\n+ size: usize,\n+ align: usize,\n+) -> Result<Layout, LayoutError>
pub const fn from_size_align(\n+ size: usize,\n+ align: usize,\n+) -> Result<Layout, LayoutError>
Constructs a Layout
from a given size
and align
,\n or returns LayoutError
if any of the following conditions\n are not met:
- \n
- \n
\nalign
must not be zero, \n - \n@@ -24,40 +24,40 @@\n \n
- \n
\nsize
, when rounded up to the nearest multiple ofalign
,\n must not overflowisize
(i.e., the rounded value must be\n less than or equal toisize::MAX
). \n
1.28.0 (const: 1.36.0) \u00b7 Sourcepub const unsafe fn from_size_align_unchecked(\n- size: usize,\n- align: usize,\n+
pub const unsafe fn from_size_align_unchecked(\n- size: usize,\n- align: usize,\n+
1.28.0 (const: 1.36.0) \u00b7 Sourcepub const unsafe fn from_size_align_unchecked(\n+ size: usize,\n+ align: usize,\n ) -> Layout
pub const unsafe fn from_size_align_unchecked(\n+ size: usize,\n+ align: usize,\n ) -> Layout
Creates a layout, bypassing all checks.
\n\u00a7Safety
\nThis function is unsafe as it does not verify the preconditions from\n Layout::from_size_align
.
1.28.0 (const: 1.50.0) \u00b7 Sourcepub const fn size(&self) -> usize
pub const fn size(&self) -> usize
The minimum size in bytes for a memory block of this layout.
\n-1.28.0 (const: 1.50.0) \u00b7 Sourcepub const fn align(&self) -> usize
pub const fn align(&self) -> usize
The minimum byte alignment for a memory block of this layout.
\n+1.28.0 (const: 1.50.0) \u00b7 Sourcepub const fn size(&self) -> usize
pub const fn size(&self) -> usize
The minimum size in bytes for a memory block of this layout.
\n+1.28.0 (const: 1.50.0) \u00b7 Sourcepub const fn align(&self) -> usize
pub const fn align(&self) -> usize
The minimum byte alignment for a memory block of this layout.
\nThe returned alignment is guaranteed to be a power of two.
\n-1.28.0 (const: 1.42.0) \u00b7 Sourcepub const fn new<T>() -> Layout
pub const fn new<T>() -> Layout
Constructs a Layout
suitable for holding a value of type T
.
1.28.0 (const: 1.85.0) \u00b7 Sourcepub const fn for_value<T>(t: &T) -> Layoutwhere\n- T: ?Sized,
pub const fn for_value<T>(t: &T) -> Layoutwhere\n- T: ?Sized,
Produces layout describing a record that could be used to\n+
1.28.0 (const: 1.42.0) \u00b7 Sourcepub const fn new<T>() -> Layout
pub const fn new<T>() -> Layout
Constructs a Layout
suitable for holding a value of type T
.
1.28.0 (const: 1.85.0) \u00b7 Sourcepub const fn for_value<T>(t: &T) -> Layoutwhere\n+ T: ?Sized,
pub const fn for_value<T>(t: &T) -> Layoutwhere\n+ T: ?Sized,
Produces layout describing a record that could be used to\n allocate backing structure for T
(which could be a trait\n or other unsized type like a slice).
Sourcepub const unsafe fn for_value_raw<T>(t: *const T) -> Layoutwhere\n- T: ?Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (layout_for_ptr
#69835)
pub const unsafe fn for_value_raw<T>(t: *const T) -> Layoutwhere\n- T: ?Sized,
layout_for_ptr
#69835)Produces layout describing a record that could be used to\n+
Sourcepub const unsafe fn for_value_raw<T>(t: *const T) -> Layoutwhere\n+ T: ?Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (layout_for_ptr
#69835)
pub const unsafe fn for_value_raw<T>(t: *const T) -> Layoutwhere\n+ T: ?Sized,
layout_for_ptr
#69835)Produces layout describing a record that could be used to\n allocate backing structure for T
(which could be a trait\n or other unsized type like a slice).
\u00a7Safety
\nThis function is only safe to call if the following conditions hold:
\n- \n
- If
T
isSized
, this function is always safe to call. \n - If the unsized tail of
T
is:\n- \n-
- a slice, then the length of the slice tail must be an initialized\n+
- a slice, then the length of the slice tail must be an initialized\n integer, and the size of the entire value\n (dynamic tail length + statically sized prefix) must fit in
isize
.\n For the special case where the dynamic tail length is 0, this function\n is safe to call. \n - a trait object, then the vtable part of the pointer must point\n to a valid vtable for the type
T
acquired by an unsizing coercion,\n and the size of the entire value\n@@ -66,48 +66,48 @@\n call, but may panic or otherwise return the wrong value, as the\n extern type\u2019s layout is not known. This is the same behavior as\nLayout::for_value
on a reference to an extern type tail. \n - otherwise, it is conservatively not allowed to call this function. \n
\n
Sourcepub const fn dangling(&self) -> NonNull<u8>
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn dangling(&self) -> NonNull<u8>
alloc_layout_extra
#55724)Creates a NonNull
that is dangling, but well-aligned for this Layout.
Sourcepub const fn dangling(&self) -> NonNull<u8>
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn dangling(&self) -> NonNull<u8>
alloc_layout_extra
#55724)Creates a NonNull
that is dangling, but well-aligned for this Layout.
Note that the pointer value may potentially represent a valid pointer,\n which means this must not be used as a \u201cnot yet initialized\u201d\n sentinel value. Types that lazily allocate must track initialization by\n some other means.
\n-1.44.0 (const: 1.85.0) \u00b7 Sourcepub const fn align_to(&self, align: usize) -> Result<Layout, LayoutError>
pub const fn align_to(&self, align: usize) -> Result<Layout, LayoutError>
Creates a layout describing the record that can hold a value\n+
1.44.0 (const: 1.85.0) \u00b7 Sourcepub const fn align_to(&self, align: usize) -> Result<Layout, LayoutError>
pub const fn align_to(&self, align: usize) -> Result<Layout, LayoutError>
Creates a layout describing the record that can hold a value\n of the same layout as self
, but that also is aligned to\n alignment align
(measured in bytes).
If self
already meets the prescribed alignment, then returns\n self
.
Note that this method does not add any padding to the overall\n size, regardless of whether the returned layout has a different\n alignment. In other words, if K
has size 16, K.align_to(32)
\n will still have size 16.
Returns an error if the combination of self.size()
and the given\n align
violates the conditions listed in Layout::from_size_align
.
Sourcepub const fn padding_needed_for(&self, align: usize) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn padding_needed_for(&self, align: usize) -> usize
alloc_layout_extra
#55724)Returns the amount of padding we must insert after self
\n+
Sourcepub const fn padding_needed_for(&self, align: usize) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn padding_needed_for(&self, align: usize) -> usize
alloc_layout_extra
#55724)Returns the amount of padding we must insert after self
\n to ensure that the following address will satisfy align
\n (measured in bytes).
e.g., if self.size()
is 9, then self.padding_needed_for(4)
\n returns 3, because that is the minimum number of bytes of\n padding required to get a 4-aligned address (assuming that the\n corresponding memory block starts at a 4-aligned address).
The return value of this function has no meaning if align
is\n not a power-of-two.
Note that the utility of the returned value requires align
\n to be less than or equal to the alignment of the starting\n address for the whole allocated block of memory. One way to\n satisfy this constraint is to ensure align <= self.align()
.
1.44.0 (const: 1.85.0) \u00b7 Sourcepub const fn pad_to_align(&self) -> Layout
pub const fn pad_to_align(&self) -> Layout
Creates a layout by rounding the size of this layout up to a multiple\n+
1.44.0 (const: 1.85.0) \u00b7 Sourcepub const fn pad_to_align(&self) -> Layout
pub const fn pad_to_align(&self) -> Layout
Creates a layout by rounding the size of this layout up to a multiple\n of the layout\u2019s alignment.
\nThis is equivalent to adding the result of padding_needed_for
\n to the layout\u2019s current size.
Sourcepub const fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutError>
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutError>
alloc_layout_extra
#55724)Creates a layout describing the record for n
instances of\n+
Sourcepub const fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutError>
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn repeat(&self, n: usize) -> Result<(Layout, usize), LayoutError>
alloc_layout_extra
#55724)Creates a layout describing the record for n
instances of\n self
, with a suitable amount of padding between each to\n ensure that each instance is given its requested size and\n alignment. On success, returns (k, offs)
where k
is the\n layout of the array and offs
is the distance between the start\n of each element in the array.
(That distance between elements is sometimes known as \u201cstride\u201d.)
\nOn arithmetic overflow, returns LayoutError
.
1.44.0 (const: 1.85.0) \u00b7 Sourcepub const fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutError>
pub const fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutError>
Creates a layout describing the record for self
followed by\n+
1.44.0 (const: 1.85.0) \u00b7 Sourcepub const fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutError>
pub const fn extend(&self, next: Layout) -> Result<(Layout, usize), LayoutError>
Creates a layout describing the record for self
followed by\n next
, including any necessary padding to ensure that next
\n will be properly aligned, but no trailing padding.
In order to match C representation layout repr(C)
, you should\n call pad_to_align
after extending the layout with all fields.\n (There is no way to match the default Rust representation\n layout repr(Rust)
, as it is unspecified.)
Note that the alignment of the resulting layout will be the maximum of\n@@ -149,42 +149,42 @@\n let (new_layout, offset) = layout.extend(field)?;\n layout = new_layout;\n offsets.push(offset);\n }\n // Remember to finalize with `pad_to_align`!\n Ok((layout.pad_to_align(), offsets))\n }
Sourcepub const fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutError>
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutError>
alloc_layout_extra
#55724)Creates a layout describing the record for n
instances of\n+
Sourcepub const fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutError>
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn repeat_packed(&self, n: usize) -> Result<Layout, LayoutError>
alloc_layout_extra
#55724)Creates a layout describing the record for n
instances of\n self
, with no padding between each instance.
Note that, unlike repeat
, repeat_packed
does not guarantee\n that the repeated instances of self
will be properly\n aligned, even if a given instance of self
is properly\n aligned. In other words, if the layout returned by\n repeat_packed
is used to allocate an array, it is not\n guaranteed that all elements in the array will be properly\n aligned.
On arithmetic overflow, returns LayoutError
.
Sourcepub const fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutError>
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutError>
alloc_layout_extra
#55724)Creates a layout describing the record for self
followed by\n+
Sourcepub const fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutError>
\ud83d\udd2cThis is a nightly-only experimental API. (alloc_layout_extra
#55724)
pub const fn extend_packed(&self, next: Layout) -> Result<Layout, LayoutError>
alloc_layout_extra
#55724)Creates a layout describing the record for self
followed by\n next
with no additional padding between the two. Since no\n padding is inserted, the alignment of next
is irrelevant,\n and is not incorporated at all into the resulting layout.
On arithmetic overflow, returns LayoutError
.
Trait Implementations\u00a7
impl Copy for Layout
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations\u00a7
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
impl<T> CloneToUninit for Twhere\n- T: Clone,
Trait Implementations\u00a7
impl Copy for Layout
impl Eq for Layout
impl StructuralPartialEq for Layout
Auto Trait Implementations\u00a7
impl Freeze for Layout
impl RefUnwindSafe for Layout
impl Send for Layout
impl Sync for Layout
impl Unpin for Layout
impl UnwindSafe for Layout
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7fn to_owned(&self) -> T
fn to_owned(&self) -> T
Source\u00a7fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
#[non_exhaustive]pub struct LayoutError;
Expand description
The LayoutError
is returned when the parameters given\n+
#[non_exhaustive]pub struct LayoutError;
Expand description
The LayoutError
is returned when the parameters given\n to Layout::from_size_align
\n or some other Layout
constructor\n do not satisfy its documented constraints.
Trait Implementations\u00a7
1.50.0 \u00b7 Source\u00a7impl Clone for LayoutError
impl Clone for LayoutError
Source\u00a7fn clone(&self) -> LayoutError
fn clone(&self) -> LayoutError
1.0.0 \u00b7 Source\u00a7fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more1.50.0 \u00b7 Source\u00a7impl Debug for LayoutError
impl Debug for LayoutError
1.28.0 \u00b7 Source\u00a7impl Display for LayoutError
impl Display for LayoutError
1.28.0 \u00b7 Source\u00a7impl Error for LayoutError
impl Error for LayoutError
1.30.0 \u00b7 Source\u00a7fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 \u00b7 Source\u00a7fn description(&self) -> &str
fn description(&self) -> &str
Source\u00a7impl From<LayoutError> for TryReserveErrorKind
impl From<LayoutError> for TryReserveErrorKind
Source\u00a7fn from(_: LayoutError) -> Self
fn from(_: LayoutError) -> Self
Always evaluates to TryReserveErrorKind::CapacityOverflow
.
1.50.0 \u00b7 Source\u00a7impl PartialEq for LayoutError
impl PartialEq for LayoutError
Source\u00a7fn eq(&self, other: &LayoutError) -> bool
fn eq(&self, other: &LayoutError) -> bool
self
and other
values to be equal, and is used by ==
.impl Eq for LayoutError
impl StructuralPartialEq for LayoutError
Auto Trait Implementations\u00a7
impl Freeze for LayoutError
impl RefUnwindSafe for LayoutError
impl Send for LayoutError
impl Sync for LayoutError
impl Unpin for LayoutError
impl UnwindSafe for LayoutError
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
impl<T, U> Into<U> for Twhere\n- U: From<T>,
Trait Implementations\u00a7
1.50.0 \u00b7 Source\u00a7impl Clone for LayoutError
impl Clone for LayoutError
Source\u00a7fn clone(&self) -> LayoutError
fn clone(&self) -> LayoutError
1.0.0 \u00b7 Source\u00a7fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more1.50.0 \u00b7 Source\u00a7impl Debug for LayoutError
impl Debug for LayoutError
1.28.0 \u00b7 Source\u00a7impl Display for LayoutError
impl Display for LayoutError
1.28.0 \u00b7 Source\u00a7impl Error for LayoutError
impl Error for LayoutError
1.30.0 \u00b7 Source\u00a7fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 \u00b7 Source\u00a7fn description(&self) -> &str
fn description(&self) -> &str
Source\u00a7impl From<LayoutError> for TryReserveErrorKind
impl From<LayoutError> for TryReserveErrorKind
Source\u00a7fn from(_: LayoutError) -> Self
fn from(_: LayoutError) -> Self
Always evaluates to TryReserveErrorKind::CapacityOverflow
.
1.50.0 \u00b7 Source\u00a7impl PartialEq for LayoutError
impl PartialEq for LayoutError
Source\u00a7fn eq(&self, other: &LayoutError) -> bool
fn eq(&self, other: &LayoutError) -> bool
self
and other
values to be equal, and is used by ==
.impl Eq for LayoutError
impl StructuralPartialEq for LayoutError
Auto Trait Implementations\u00a7
impl Freeze for LayoutError
impl RefUnwindSafe for LayoutError
impl Send for LayoutError
impl Sync for LayoutError
impl Unpin for LayoutError
impl UnwindSafe for LayoutError
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7fn to_owned(&self) -> T
fn to_owned(&self) -> T
Source\u00a7fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
pub unsafe trait Allocator {\n+Allocator in alloc::alloc - Rust pub unsafe trait Allocator {\n // Required methods\n- fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>;\n- unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout);\n+ fn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>;\n+ unsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout);\n \n // Provided methods\n fn allocate_zeroed(\n &self,\n layout: Layout,\n- ) -> Result<NonNull<[u8]>, AllocError> { ... }\n+ ) -> Result<NonNull<[u8]>, AllocError> { ... }\n unsafe fn grow(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n- ) -> Result<NonNull<[u8]>, AllocError> { ... }\n+ ) -> Result<NonNull<[u8]>, AllocError> { ... }\n unsafe fn grow_zeroed(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n- ) -> Result<NonNull<[u8]>, AllocError> { ... }\n+ ) -> Result<NonNull<[u8]>, AllocError> { ... }\n unsafe fn shrink(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n- ) -> Result<NonNull<[u8]>, AllocError> { ... }\n+ ) -> Result<NonNull<[u8]>, AllocError> { ... }\n fn by_ref(&self) -> &Self\n- where Self: Sized { ... }\n+ where Self: Sized { ... }\n }
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)Expand description
An implementation of Allocator
can allocate, grow, shrink, and deallocate arbitrary blocks of\n data described via Layout
.
\n Allocator
is designed to be implemented on ZSTs, references, or smart pointers because having\n an allocator like MyAlloc([u8; N])
cannot be moved, without updating the pointers to the\n allocated memory.
\n Unlike GlobalAlloc
, zero-sized allocations are allowed in Allocator
. If an underlying\n allocator does not support this (like jemalloc) or return a null pointer (such as\n@@ -83,16 +83,16 @@\n allocator. A copied or cloned allocator must behave like the same allocator, and
\n \n \n any pointer to a memory block which is currently allocated may be passed to any other\n method of the allocator.
\n \n \n-Required Methods\u00a7
Sourcefn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Attempts to allocate a block of memory.
\n-On success, returns a NonNull<[u8]>
meeting the size and alignment guarantees of layout
.
\n+Required Methods\u00a7
Sourcefn allocate(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Attempts to allocate a block of memory.
\n+On success, returns a NonNull<[u8]>
meeting the size and alignment guarantees of layout
.
\n The returned block may have a larger size than specified by layout.size()
, and may or may\n not have its contents initialized.
\n The returned block of memory remains valid as long as it is [currently allocated] and the shorter of:
\n \n - the borrow-checker lifetime of the allocator type itself.
\n - as long as at the allocator and all its clones has not been dropped.
\n
\n@@ -100,36 +100,36 @@\n Returning Err
indicates that either memory is exhausted or layout
does not meet\n allocator\u2019s size or alignment constraints.
\n Implementations are encouraged to return Err
on memory exhaustion rather than panicking or\n aborting, but this is not a strict requirement. (Specifically: it is legal to implement\n this trait atop an underlying native allocation library that aborts on memory exhaustion.)
\n Clients wishing to abort computation in response to an allocation error are encouraged to\n call the handle_alloc_error
function, rather than directly invoking panic!
or similar.
\n-Sourceunsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Deallocates the memory referenced by ptr
.
\n+Sourceunsafe fn deallocate(&self, ptr: NonNull<u8>, layout: Layout)
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Deallocates the memory referenced by ptr
.
\n \u00a7Safety
\n \n ptr
must denote a block of memory currently allocated via this allocator, and \n layout
must fit that block of memory. \n
\n-Provided Methods\u00a7
Sourcefn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Behaves like allocate
, but also ensures that the returned memory is zero-initialized.
\n+Provided Methods\u00a7
Sourcefn allocate_zeroed(&self, layout: Layout) -> Result<NonNull<[u8]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Behaves like allocate
, but also ensures that the returned memory is zero-initialized.
\n \u00a7Errors
\n Returning Err
indicates that either memory is exhausted or layout
does not meet\n allocator\u2019s size or alignment constraints.
\n Implementations are encouraged to return Err
on memory exhaustion rather than panicking or\n aborting, but this is not a strict requirement. (Specifically: it is legal to implement\n this trait atop an underlying native allocation library that aborts on memory exhaustion.)
\n Clients wishing to abort computation in response to an allocation error are encouraged to\n call the handle_alloc_error
function, rather than directly invoking panic!
or similar.
\n-Sourceunsafe fn grow(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n-) -> Result<NonNull<[u8]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Attempts to extend the memory block.
\n-Returns a new NonNull<[u8]>
containing a pointer and the actual size of the allocated\n+) -> Result<NonNull<[u8]>, AllocError>\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Attempts to extend the memory block.
\n+Returns a new NonNull<[u8]>
containing a pointer and the actual size of the allocated\n memory. The pointer is suitable for holding data described by new_layout
. To accomplish\n this, the allocator may extend the allocation referenced by ptr
to fit the new layout.
\n If this returns Ok
, then ownership of the memory block referenced by ptr
has been\n transferred to this allocator. Any access to the old ptr
is Undefined Behavior, even if the\n allocation was grown in-place. The newly returned pointer is the only valid pointer\n for accessing this memory now.
\n If this method returns Err
, then ownership of the memory block has not been transferred to\n@@ -145,20 +145,20 @@\n
Returns Err
if the new layout does not meet the allocator\u2019s size and alignment\n constraints of the allocator, or if growing otherwise fails.
\n Implementations are encouraged to return Err
on memory exhaustion rather than panicking or\n aborting, but this is not a strict requirement. (Specifically: it is legal to implement\n this trait atop an underlying native allocation library that aborts on memory exhaustion.)
\n Clients wishing to abort computation in response to an allocation error are encouraged to\n call the handle_alloc_error
function, rather than directly invoking panic!
or similar.
\n-Sourceunsafe fn grow_zeroed(\n+
Sourceunsafe fn grow_zeroed(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n-) -> Result<NonNull<[u8]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Behaves like grow
, but also ensures that the new contents are set to zero before being\n+) -> Result<NonNull<[u8]>, AllocError>\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Behaves like grow
, but also ensures that the new contents are set to zero before being\n returned.
\n The memory block will contain the following contents after a successful call to\n grow_zeroed
:
\n \n - Bytes
0..old_layout.size()
are preserved from the original allocation. \n - Bytes
old_layout.size()..old_size
will either be preserved or zeroed, depending on\n the allocator implementation. old_size
refers to the size of the memory block prior\n@@ -178,21 +178,21 @@\n Returns Err
if the new layout does not meet the allocator\u2019s size and alignment\n constraints of the allocator, or if growing otherwise fails.
\n Implementations are encouraged to return Err
on memory exhaustion rather than panicking or\n aborting, but this is not a strict requirement. (Specifically: it is legal to implement\n this trait atop an underlying native allocation library that aborts on memory exhaustion.)
\n Clients wishing to abort computation in response to an allocation error are encouraged to\n call the handle_alloc_error
function, rather than directly invoking panic!
or similar.
\n-
Sourceunsafe fn shrink(\n &self,\n- ptr: NonNull<u8>,\n+ ptr: NonNull<u8>,\n old_layout: Layout,\n new_layout: Layout,\n-) -> Result<NonNull<[u8]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Attempts to shrink the memory block.
\n-Returns a new NonNull<[u8]>
containing a pointer and the actual size of the allocated\n+) -> Result<NonNull<[u8]>, AllocError>\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Attempts to shrink the memory block.
\n+Returns a new NonNull<[u8]>
containing a pointer and the actual size of the allocated\n memory. The pointer is suitable for holding data described by new_layout
. To accomplish\n this, the allocator may shrink the allocation referenced by ptr
to fit the new layout.
\n If this returns Ok
, then ownership of the memory block referenced by ptr
has been\n transferred to this allocator. Any access to the old ptr
is Undefined Behavior, even if the\n allocation was shrunk in-place. The newly returned pointer is the only valid pointer\n for accessing this memory now.
\n If this method returns Err
, then ownership of the memory block has not been transferred to\n@@ -208,12 +208,12 @@\n
Returns Err
if the new layout does not meet the allocator\u2019s size and alignment\n constraints of the allocator, or if shrinking otherwise fails.
\n Implementations are encouraged to return Err
on memory exhaustion rather than panicking or\n aborting, but this is not a strict requirement. (Specifically: it is legal to implement\n this trait atop an underlying native allocation library that aborts on memory exhaustion.)
\n Clients wishing to abort computation in response to an allocation error are encouraged to\n call the handle_alloc_error
function, rather than directly invoking panic!
or similar.
\n-Implementors\u00a7
\n+
Implementors\u00a7
pub unsafe trait GlobalAlloc {\n+GlobalAlloc in alloc::alloc - Rust pub unsafe trait GlobalAlloc {\n // Required methods\n- unsafe fn alloc(&self, layout: Layout) -> *mut u8;\n- unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);\n+ unsafe fn alloc(&self, layout: Layout) -> *mut u8;\n+ unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout);\n \n // Provided methods\n- unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { ... }\n+ unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 { ... }\n unsafe fn realloc(\n &self,\n- ptr: *mut u8,\n+ ptr: *mut u8,\n layout: Layout,\n- new_size: usize,\n- ) -> *mut u8 { ... }\n+ new_size: usize,\n+ ) -> *mut u8 { ... }\n }
Expand description
A memory allocator that can be registered as the standard library\u2019s default\n through the #[global_allocator]
attribute.
\n Some of the methods require that a memory block be currently\n allocated via an allocator. This means that:
\n \n - \n
the starting address for that memory block was previously\n@@ -119,15 +119,15 @@\n optimization that can be applied. You may generally not rely on heap allocations\n happening if they can be removed without changing program behavior.\n Whether allocations happen or not is not part of the program behavior, even if it\n could be detected via an allocator that tracks allocations by printing or otherwise\n having side effects.
\n \n
\n-Required Methods\u00a7
1.28.0 \u00b7 Sourceunsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given layout
.
\n+Required Methods\u00a7
1.28.0 \u00b7 Sourceunsafe fn alloc(&self, layout: Layout) -> *mut u8
Allocates memory as described by the given layout
.
\n Returns a pointer to newly-allocated memory,\n or null to indicate allocation failure.
\n \u00a7Safety
\n layout
must have non-zero size. Attempting to allocate for a zero-sized layout
may\n result in undefined behavior.
\n (Extension subtraits might provide more specific bounds on\n behavior, e.g., guarantee a sentinel address or a null pointer\n@@ -140,46 +140,46 @@\n exhaustion rather than aborting, but this is not\n a strict requirement. (Specifically: it is legal to\n implement this trait atop an underlying native allocation\n library that aborts on memory exhaustion.)
\n Clients wishing to abort computation in response to an\n allocation error are encouraged to call the handle_alloc_error
function,\n rather than directly invoking panic!
or similar.
\n-1.28.0 \u00b7 Sourceunsafe fn dealloc(&self, ptr: *mut u8, layout: Layout)
Deallocates the block of memory at the given ptr
pointer with the given layout
.
\n+1.28.0 \u00b7 Sourceunsafe fn dealloc(&self, ptr: *mut u8, layout: Layout)
Deallocates the block of memory at the given ptr
pointer with the given layout
.
\n \u00a7Safety
\n The caller must ensure:
\n \n - \n
ptr
is a block of memory currently allocated via this allocator and,
\n \n - \n
layout
is the same layout that was used to allocate that block of\n memory.
\n \n
\n Otherwise undefined behavior can result.
\n-Provided Methods\u00a7
1.28.0 \u00b7 Sourceunsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
Behaves like alloc
, but also ensures that the contents\n+
Provided Methods\u00a7
1.28.0 \u00b7 Sourceunsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8
Behaves like alloc
, but also ensures that the contents\n are set to zero before being returned.
\n \u00a7Safety
\n The caller has to ensure that layout
has non-zero size. Like alloc
\n zero sized layout
can result in undefined behavior.\n However the allocated block of memory is guaranteed to be initialized.
\n \u00a7Errors
\n Returning a null pointer indicates that either memory is exhausted\n or layout
does not meet allocator\u2019s size or alignment constraints,\n just as in alloc
.
\n Clients wishing to abort computation in response to an\n allocation error are encouraged to call the handle_alloc_error
function,\n rather than directly invoking panic!
or similar.
\n-1.28.0 \u00b7 Sourceunsafe fn realloc(\n &self,\n- ptr: *mut u8,\n+ ptr: *mut u8,\n layout: Layout,\n- new_size: usize,\n-) -> *mut u8
Shrinks or grows a block of memory to the given new_size
in bytes.\n+ new_size: usize,\n+) -> *mut u8
Shrinks or grows a block of memory to the given new_size
in bytes.\n The block is described by the given ptr
pointer and layout
.
\n If this returns a non-null pointer, then ownership of the memory block\n referenced by ptr
has been transferred to this allocator.\n Any access to the old ptr
is Undefined Behavior, even if the\n allocation remained in-place. The newly returned pointer is the only valid pointer\n for accessing this memory now.
\n The new memory block is allocated with layout
,\n"}, {"source1": "./usr/share/doc/rust-doc/html/alloc/alloc/type.LayoutErr.html", "source2": "./usr/share/doc/rust-doc/html/alloc/alloc/type.LayoutErr.html", "unified_diff": "@@ -1 +1 @@\n-
LayoutErr in alloc::alloc - Rust pub type LayoutErr = LayoutError;
\ud83d\udc4eDeprecated since 1.52.0: Name does not follow std convention, use LayoutErrorAliased Type\u00a7
struct LayoutErr;
\n+LayoutErr in alloc::alloc - Rust pub type LayoutErr = LayoutError;
\ud83d\udc4eDeprecated since 1.52.0: Name does not follow std convention, use LayoutErrorAliased Type\u00a7
struct LayoutErr;
\n"}, {"source1": "./usr/share/doc/rust-doc/html/alloc/borrow/enum.Cow.html", "source2": "./usr/share/doc/rust-doc/html/alloc/borrow/enum.Cow.html", "unified_diff": "@@ -1,10 +1,10 @@\n Cow in alloc::borrow - Rust {\n+ Borrowed(&'a B),\n Owned(<B as ToOwned>::Owned),\n }Expand description
A clone-on-write smart pointer.
\n The type Cow
is a smart pointer providing clone-on-write functionality: it\n can enclose and provide immutable access to borrowed data, and clone the\n data lazily when mutation or ownership is required. The type is designed to\n work with general borrowed data via the Borrow
trait.
\n Cow
implements Deref
, which means that you can call\n@@ -69,27 +69,27 @@\n println!(\"clone_on_write = {:?}\", clone_on_write.values);\n \n // The data was mutated. Let's check it out.\n match clone_on_write {\n Items { values: Cow::Owned(_) } => println!(\"clone_on_write contains owned data\"),\n _ => panic!(\"expect owned data\"),\n }
\n- Variants\u00a7
\u00a71.36.0Borrowed(&'a B)
Borrowed data.
\n+Variants\u00a7
Implementations\u00a7
Source\u00a7impl<B: ?Sized + ToOwned> Cow<'_, B>
Sourcepub const fn is_borrowed(&self) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (cow_is_borrowed
#65143)
Returns true if the data is borrowed, i.e. if to_mut
would require additional work.
\n+Implementations\u00a7
Source\u00a7impl<B: ?Sized + ToOwned> Cow<'_, B>
Sourcepub const fn is_borrowed(&self) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (cow_is_borrowed
#65143)
Returns true if the data is borrowed, i.e. if to_mut
would require additional work.
\n \u00a7Examples
\n \n-Sourcepub const fn is_owned(&self) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (cow_is_borrowed
#65143)
Returns true if the data is owned, i.e. if to_mut
would be a no-op.
\n+Sourcepub const fn is_owned(&self) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (cow_is_borrowed
#65143)
Returns true if the data is owned, i.e. if to_mut
would be a no-op.
\n \u00a7Examples
\n #![feature(cow_is_borrowed)]\n use std::borrow::Cow;\n \n let cow: Cow<'_, str> = Cow::Owned(\"moo\".to_string());\n assert!(cow.is_owned());\n \n@@ -129,181 +129,181 @@\n let s = \"Hello world!\";\n let cow: Cow<'_, str> = Cow::Owned(String::from(s));\n \n assert_eq!(\n cow.into_owned(),\n String::from(s)\n );
\n-Trait Implementations\u00a7
1.14.0 \u00b7 Source\u00a7impl<'a> AddAssign<&'a str> for Cow<'a, str>
Source\u00a7fn add_assign(&mut self, rhs: &'a str)
Performs the +=
operation. Read more1.19.0 \u00b7 Source\u00a7impl<'a> Extend<Cow<'a, str>> for String
Source\u00a7fn extend<I: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read moreTrait Implementations\u00a7
1.14.0 \u00b7 Source\u00a7impl<'a> AddAssign<&'a str> for Cow<'a, str>
Source\u00a7fn add_assign(&mut self, rhs: &'a str)
Performs the +=
operation. Read more1.19.0 \u00b7 Source\u00a7impl<'a> Extend<Cow<'a, str>> for String
Source\u00a7fn extend<I: IntoIterator<Item = Cow<'a, str>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more1.45.0 \u00b7 Source\u00a7impl From<Cow<'_, str>> for Box<str>
Source\u00a7fn from(cow: Cow<'_, str>) -> Box<str>
Converts a Cow<'_, str>
into a Box<str>
\n When cow
is the Cow::Borrowed
variant, this\n conversion allocates on the heap and copies the\n underlying str
. Otherwise, it will try to reuse the owned\n String
\u2019s allocation.
\n \u00a7Examples
\n \n \n \n-1.14.0 \u00b7 Source\u00a7impl<'a, T> From<Cow<'a, [T]>> for Vec<T>
1.45.0 \u00b7 Source\u00a7impl<'a, B> From<Cow<'a, B>> for Arc<B>
1.14.0 \u00b7 Source\u00a7impl<'a> From<Cow<'a, str>> for String
1.22.0 \u00b7 Source\u00a7impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + 'a>
1.22.0 \u00b7 Source\u00a7impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a>
1.0.0 \u00b7 Source\u00a7impl<'a> From<String> for Cow<'a, str>
1.0.0 \u00b7 Source\u00a7impl<B> Ord for Cow<'_, B>
1.21.0 \u00b7 Source\u00a7fn max(self, other: Self) -> Selfwhere\n- Self: Sized,
Compares and returns the maximum of two values. Read more1.0.0 \u00b7 Source\u00a7impl<'a, B> PartialOrd for Cow<'a, B>
Source\u00a7impl<B: ?Sized + ToOwned> DerefPure for Cow<'_, B>
1.0.0 \u00b7 Source\u00a7impl<B> Eq for Cow<'_, B>
Auto Trait Implementations\u00a7
\u00a7impl<'a, B> Freeze for Cow<'a, B>
\u00a7impl<'a, B> RefUnwindSafe for Cow<'a, B>
\u00a7impl<'a, B> Send for Cow<'a, B>
\u00a7impl<'a, B> Sync for Cow<'a, B>
\u00a7impl<'a, B> Unpin for Cow<'a, B>
\u00a7impl<'a, B> UnwindSafe for Cow<'a, B>
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moreSource\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
1.0.0 \u00b7 Source\u00a7impl<B> Ord for Cow<'_, B>
1.21.0 \u00b7 Source\u00a7fn max(self, other: Self) -> Selfwhere\n+ Self: Sized,
Compares and returns the maximum of two values. Read more1.0.0 \u00b7 Source\u00a7impl<'a, B> PartialOrd for Cow<'a, B>
Source\u00a7impl<B: ?Sized + ToOwned> DerefPure for Cow<'_, B>
1.0.0 \u00b7 Source\u00a7impl<B> Eq for Cow<'_, B>
Auto Trait Implementations\u00a7
\u00a7impl<'a, B> Freeze for Cow<'a, B>
\u00a7impl<'a, B> RefUnwindSafe for Cow<'a, B>
\u00a7impl<'a, B> Send for Cow<'a, B>
\u00a7impl<'a, B> Sync for Cow<'a, B>
\u00a7impl<'a, B> Unpin for Cow<'a, B>
\u00a7impl<'a, B> UnwindSafe for Cow<'a, B>
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moreSource\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
\n+From<T> for U
chooses to do.\n+ \n"}, {"source1": "./usr/share/doc/rust-doc/html/alloc/borrow/trait.Borrow.html", "source2": "./usr/share/doc/rust-doc/html/alloc/borrow/trait.Borrow.html", "unified_diff": "@@ -1,20 +1,20 @@\n-Borrow in alloc::borrow - Rust pub trait Borrow<Borrowed>where\n- Borrowed: ?Sized,{\n+Borrow in alloc::borrow - Rust pub trait Borrow<Borrowed>where\n+ Borrowed: ?Sized,{\n // Required method\n- fn borrow(&self) -> &Borrowed;\n+ fn borrow(&self) -> &Borrowed;\n }
Expand description
A trait for borrowing data.
\n In Rust, it is common to provide different representations of a type for\n different use cases. For instance, storage location and management for a\n value can be specifically chosen as appropriate for a particular use via\n pointer types such as Box<T>
or Rc<T>
. Beyond these generic\n wrappers that can be used with any type, some types provide optional\n facets providing potentially costly functionality. An example for such a\n type is String
which adds the ability to extend a string to the basic\n-str
. This requires keeping additional information unnecessary for a\n+str
. This requires keeping additional information unnecessary for a\n simple, immutable string.
\n These types provide access to the underlying data through references\n to the type of that data. They are said to be \u2018borrowed as\u2019 that type.\n For instance, a Box<T>
can be borrowed as T
while a String
\n can be borrowed as str
.
\n Types express that they can be borrowed as some type T
by implementing\n Borrow<T>
, providing a reference to a T
in the trait\u2019s\n@@ -28,22 +28,22 @@\n on the identical behavior of these additional trait implementations.\n These traits will likely appear as additional trait bounds.
\n In particular Eq
, Ord
and Hash
must be equivalent for\n borrowed and owned values: x.borrow() == y.borrow()
should give the\n same result as x == y
.
\n If generic code merely needs to work for all types that can\n provide a reference to related type T
, it is often better to use\n-AsRef<T>
as more types can safely implement it.
\n+AsRef<T>
as more types can safely implement it.\n \u00a7Examples
\n As a data collection, HashMap<K, V>
owns both keys and values. If\n the key\u2019s actual data is wrapped in a managing type of some kind, it\n should, however, still be possible to search for a value using a\n reference to the key\u2019s data. For instance, if the key is a string, then\n it is likely stored with the hash map as a String
, while it should\n-be possible to search using a &str
. Thus, insert
needs to\n+be possible to search using a &str
. Thus, insert
needs to\n operate on a String
while get
needs to be able to use a &str
.
\n Slightly simplified, the relevant parts of HashMap<K, V>
look like\n this:
\n \n \n Can CaseInsensitiveString
implement Borrow<str>
? It certainly can\n provide a reference to a string slice via its contained owned string.\n But because its Hash
implementation differs, it behaves differently\n from str
and therefore must not, in fact, implement Borrow<str>
.\n If it wants to allow others access to the underlying str
, it can do\n that via AsRef<str>
which doesn\u2019t carry any extra requirements.
\n-Required Methods\u00a7
Required Methods\u00a7
Implementors\u00a7
1.0.0 \u00b7 Source\u00a7impl Borrow<str> for String
1.3.0 \u00b7 Source\u00a7impl Borrow<CStr> for CString
1.0.0 \u00b7 Source\u00a7impl<'a, B> Borrow<B> for Cow<'a, B>
1.0.0 \u00b7 Source\u00a7impl<T> Borrow<T> for &Twhere\n- T: ?Sized,
1.0.0 \u00b7 Source\u00a7impl<T> Borrow<T> for &mut Twhere\n- T: ?Sized,
1.0.0 \u00b7 Source\u00a7impl<T> Borrow<T> for Twhere\n- T: ?Sized,
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> Borrow<[T]> for Vec<T, A>
1.4.0 \u00b7 Source\u00a7impl<T, const N: usize> Borrow<[T]> for [T; N]
1.1.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> Borrow<T> for Box<T, A>
1.0.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> Borrow<T> for Rc<T, A>
Source\u00a7impl<T: ?Sized, A: Allocator> Borrow<T> for UniqueRc<T, A>
1.0.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> Borrow<T> for Arc<T, A>
\n+
Implementors\u00a7
1.0.0 \u00b7 Source\u00a7impl Borrow<str> for String
1.3.0 \u00b7 Source\u00a7impl Borrow<CStr> for CString
1.0.0 \u00b7 Source\u00a7impl<'a, B> Borrow<B> for Cow<'a, B>
1.0.0 \u00b7 Source\u00a7impl<T> Borrow<T> for &Twhere\n+ T: ?Sized,
1.0.0 \u00b7 Source\u00a7impl<T> Borrow<T> for &mut Twhere\n+ T: ?Sized,
1.0.0 \u00b7 Source\u00a7impl<T> Borrow<T> for Twhere\n+ T: ?Sized,
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> Borrow<[T]> for Vec<T, A>
1.4.0 \u00b7 Source\u00a7impl<T, const N: usize> Borrow<[T]> for [T; N]
1.1.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> Borrow<T> for Box<T, A>
1.0.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> Borrow<T> for Rc<T, A>
Source\u00a7impl<T: ?Sized, A: Allocator> Borrow<T> for UniqueRc<T, A>
1.0.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> Borrow<T> for Arc<T, A>
pub trait BorrowMut<Borrowed>: Borrow<Borrowed>where\n- Borrowed: ?Sized,{\n+BorrowMut in alloc::borrow - Rust pub trait BorrowMut<Borrowed>: Borrow<Borrowed>where\n+ Borrowed: ?Sized,{\n // Required method\n- fn borrow_mut(&mut self) -> &mut Borrowed;\n+ fn borrow_mut(&mut self) -> &mut Borrowed;\n }
Expand description
Required Methods\u00a7
1.0.0 \u00b7 Sourcefn borrow_mut(&mut self) -> &mut Borrowed
Mutably borrows from an owned value.
\n+Required Methods\u00a7
1.0.0 \u00b7 Sourcefn borrow_mut(&mut self) -> &mut Borrowed
Mutably borrows from an owned value.
\n \u00a7Examples
\n \n-Implementors\u00a7
1.36.0 \u00b7 Source\u00a7impl BorrowMut<str> for String
1.0.0 \u00b7 Source\u00a7impl<T> BorrowMut<T> for &mut Twhere\n- T: ?Sized,
1.0.0 \u00b7 Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> BorrowMut<[T]> for Vec<T, A>
1.4.0 \u00b7 Source\u00a7impl<T, const N: usize> BorrowMut<[T]> for [T; N]
1.1.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> BorrowMut<T> for Box<T, A>
Source\u00a7impl<T: ?Sized, A: Allocator> BorrowMut<T> for UniqueRc<T, A>
\n+
Implementors\u00a7
impl BorrowMut<str> for String
impl<T> BorrowMut<T> for &mut Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T, A: Allocator> BorrowMut<[T]> for Vec<T, A>
impl<T, const N: usize> BorrowMut<[T]> for [T; N]
impl<T: ?Sized, A: Allocator> BorrowMut<T> for Box<T, A>
impl<T: ?Sized, A: Allocator> BorrowMut<T> for UniqueRc<T, A>
Provided Methods\u00a7
1.63.0 \u00b7 Sourcefn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning.
\n-This is borrow-generalized version of Clone::clone_from
.
This is borrow-generalized version of Clone::clone_from
.
\u00a7Examples
\nBasic usage:
\n \n \n-Dyn Compatibility\u00a7
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\u00a7
Dyn Compatibility\u00a7
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\u00a7
isize::MAX
bytes.\n \u00a7Examples
\nMove a value from the stack to the heap by creating a Box
:
Move a value from a Box
back to the stack by dereferencing:
Move a value from a Box
back to the stack by dereferencing:
Creating a recursive data structure:
\n \n#[allow(dead_code)]\n #[derive(Debug)]\n@@ -39,15 +39,15 @@\n pointer points to a valid value of the right type. More precisely, a value: *mut T
that has\n been allocated with the Global
allocator with Layout::for_value(&*value)
may be converted\n into a box using Box::<T>::from_raw(value)
. Conversely, the memory backing a value: *mut T
\n obtained from Box::<T>::into_raw
may be deallocated using the Global
allocator with\n Layout::for_value(&*value)
.\n For zero-sized values, the Box
pointer has to be non-null and sufficiently aligned. The\n recommended way to build a Box to a ZST if Box::new
cannot be used is to use\n-ptr::NonNull::dangling
.
\n+ptr::NonNull::dangling
.\n On top of these basic layout requirements, a Box<T>
must point to a valid value of T
.
\n So long as T: Sized
, a Box<T>
is guaranteed to be represented\n as a single pointer and is also ABI-compatible with C pointers\n (i.e. the C type T*
). This means that if you have extern \u201cC\u201d\n Rust functions that will be called from C, you can define those\n Rust functions using Box<T>
types, and use T*
as corresponding\n type on the C side. As an example, consider this C header which\n@@ -96,15 +96,15 @@\n
The aliasing rules for Box<T>
are the same as for &mut T
. Box<T>
\n asserts uniqueness over its content. Using raw pointers derived from a box\n after that box has been mutated through, moved or borrowed as &mut T
\n is not allowed. For more guidance on working with box from unsafe code, see\n rust-lang/unsafe-code-guidelines#326.
\n \u00a7Editions
\n A special case exists for the implementation of IntoIterator
for arrays on the Rust 2021\n-edition, as documented here. Unfortunately, it was later found that a similar\n+edition, as documented here. Unfortunately, it was later found that a similar\n workaround should be added for boxed slices, and this was applied in the 2024 edition.
\n Specifically, IntoIterator
is implemented for Box<[T]>
on all editions, but specific calls\n to into_iter()
for boxed slices will defer to the slice implementation on editions before\n 2024:
\n \n \u24d8// Rust 2015, 2018, and 2021:\n \n"}, {"source1": "./usr/share/doc/rust-doc/html/alloc/boxed/struct.Box.html", "source2": "./usr/share/doc/rust-doc/html/alloc/boxed/struct.Box.html", "unified_diff": "@@ -1,79 +1,79 @@\n-Box in alloc::boxed - Rust pub struct Box<T: ?Sized, A: Allocator = Global>(/* private fields */);
Expand description
A pointer type that uniquely owns a heap allocation of type T
.
\n+Box in alloc::boxed - Rust pub struct Box<T: ?Sized, A: Allocator = Global>(/* private fields */);
Expand description
A pointer type that uniquely owns a heap allocation of type T
.
\n See the module-level documentation for more.
\n-Implementations\u00a7
Source\u00a7impl<A: Allocator> Box<dyn Any, A>
1.0.0 \u00b7 Sourcepub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self>
Attempts to downcast the box to a concrete type.
\n+Implementations\u00a7
Source\u00a7impl<A: Allocator> Box<dyn Any, A>
1.0.0 \u00b7 Sourcepub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self>
Attempts to downcast the box to a concrete type.
\n \u00a7Examples
\n use std::any::Any;\n \n fn print_if_string(value: Box<dyn Any>) {\n if let Ok(string) = value.downcast::<String>() {\n println!(\"String ({}): {}\", string.len(), string);\n }\n }\n \n let my_string = \"Hello World\".to_string();\n print_if_string(Box::new(my_string));\n print_if_string(Box::new(0i8));
\n-Sourcepub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (downcast_unchecked
#90850)
Downcasts the box to a concrete type.
\n+Sourcepub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (downcast_unchecked
#90850)
Downcasts the box to a concrete type.
\n For a safe alternative see downcast
.
\n \u00a7Examples
\n #![feature(downcast_unchecked)]\n \n use std::any::Any;\n \n let x: Box<dyn Any> = Box::new(1_usize);\n \n unsafe {\n assert_eq!(*x.downcast_unchecked::<usize>(), 1);\n }
\n \u00a7Safety
\n The contained value must be of type T
. Calling this method\n with the incorrect type is undefined behavior.
\n-Source\u00a7impl<A: Allocator> Box<dyn Any + Send, A>
1.0.0 \u00b7 Sourcepub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self>
Attempts to downcast the box to a concrete type.
\n \u00a7Examples
\n use std::any::Any;\n \n fn print_if_string(value: Box<dyn Any + Send>) {\n if let Ok(string) = value.downcast::<String>() {\n println!(\"String ({}): {}\", string.len(), string);\n }\n }\n \n let my_string = \"Hello World\".to_string();\n print_if_string(Box::new(my_string));\n print_if_string(Box::new(0i8));
\n-Sourcepub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (downcast_unchecked
#90850)
Downcasts the box to a concrete type.
\n+Sourcepub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (downcast_unchecked
#90850)
Downcasts the box to a concrete type.
\n For a safe alternative see downcast
.
\n \u00a7Examples
\n #![feature(downcast_unchecked)]\n \n use std::any::Any;\n \n let x: Box<dyn Any + Send> = Box::new(1_usize);\n \n unsafe {\n assert_eq!(*x.downcast_unchecked::<usize>(), 1);\n }
\n \u00a7Safety
\n The contained value must be of type T
. Calling this method\n with the incorrect type is undefined behavior.
\n-Source\u00a7impl<A: Allocator> Box<dyn Any + Send + Sync, A>
1.51.0 \u00b7 Sourcepub fn downcast<T: Any>(self) -> Result<Box<T, A>, Self>
Attempts to downcast the box to a concrete type.
\n \u00a7Examples
\n use std::any::Any;\n \n fn print_if_string(value: Box<dyn Any + Send + Sync>) {\n if let Ok(string) = value.downcast::<String>() {\n println!(\"String ({}): {}\", string.len(), string);\n }\n }\n \n let my_string = \"Hello World\".to_string();\n print_if_string(Box::new(my_string));\n print_if_string(Box::new(0i8));
\n-Sourcepub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (downcast_unchecked
#90850)
Downcasts the box to a concrete type.
\n+Sourcepub unsafe fn downcast_unchecked<T: Any>(self) -> Box<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (downcast_unchecked
#90850)
Downcasts the box to a concrete type.
\n For a safe alternative see downcast
.
\n \u00a7Examples
\n #![feature(downcast_unchecked)]\n \n use std::any::Any;\n \n let x: Box<dyn Any + Send + Sync> = Box::new(1_usize);\n@@ -84,68 +84,68 @@\n \u00a7Safety
\n The contained value must be of type T
. Calling this method\n with the incorrect type is undefined behavior.
\n
Source\u00a7impl<T> Box<T>
1.0.0 \u00b7 Sourcepub fn new(x: T) -> Self
Allocates memory on the heap and then places x
into it.
\n This doesn\u2019t actually allocate if T
is zero-sized.
\n \u00a7Examples
\n \n-1.82.0 \u00b7 Sourcepub fn new_uninit() -> Box<MaybeUninit<T>>
Constructs a new box with uninitialized contents.
\n+1.82.0 \u00b7 Sourcepub fn new_uninit() -> Box<MaybeUninit<T>>
Constructs a new box with uninitialized contents.
\n \u00a7Examples
\n \n-Sourcepub fn new_zeroed() -> Box<MaybeUninit<T>>
\ud83d\udd2cThis is a nightly-only experimental API. (new_zeroed_alloc
#129396)
Constructs a new Box
with uninitialized contents, with the memory\n+
Sourcepub fn new_zeroed() -> Box<MaybeUninit<T>>
\ud83d\udd2cThis is a nightly-only experimental API. (new_zeroed_alloc
#129396)
Constructs a new Box
with uninitialized contents, with the memory\n being filled with 0
bytes.
\n-See MaybeUninit::zeroed
for examples of correct and incorrect usage\n+
See MaybeUninit::zeroed
for examples of correct and incorrect usage\n of this method.
\n \u00a7Examples
\n \n-1.33.0 \u00b7 Sourcepub fn pin(x: T) -> Pin<Box<T>>
Constructs a new Pin<Box<T>>
. If T
does not implement Unpin
, then\n+
1.33.0 \u00b7 Sourcepub fn pin(x: T) -> Pin<Box<T>>
Constructs a new Pin<Box<T>>
. If T
does not implement Unpin
, then\n x
will be pinned in memory and unable to be moved.
\n Constructing and pinning of the Box
can also be done in two steps: Box::pin(x)
\n does the same as Box::into_pin(Box::new(x))
. Consider using\n into_pin
if you already have a Box<T>
, or if you want to\n construct a (pinned) Box
in a different way than with Box::new
.
\n-Sourcepub fn try_new(x: T) -> Result<Self, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Allocates memory on the heap then places x
into it,\n+
Sourcepub fn try_new(x: T) -> Result<Self, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Allocates memory on the heap then places x
into it,\n returning an error if the allocation fails
\n This doesn\u2019t actually allocate if T
is zero-sized.
\n \u00a7Examples
\n \n-Sourcepub fn try_new_uninit() -> Result<Box<MaybeUninit<T>>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new box with uninitialized contents on the heap,\n+
Sourcepub fn try_new_uninit() -> Result<Box<MaybeUninit<T>>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new box with uninitialized contents on the heap,\n returning an error if the allocation fails
\n \u00a7Examples
\n \n-Sourcepub fn try_new_zeroed() -> Result<Box<MaybeUninit<T>>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new Box
with uninitialized contents, with the memory\n+
Sourcepub fn try_new_zeroed() -> Result<Box<MaybeUninit<T>>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new Box
with uninitialized contents, with the memory\n being filled with 0
bytes on the heap
\n-See MaybeUninit::zeroed
for examples of correct and incorrect usage\n+
See MaybeUninit::zeroed
for examples of correct and incorrect usage\n of this method.
\n \u00a7Examples
\n #![feature(allocator_api)]\n \n let zero = Box::<u32>::try_new_zeroed()?;\n let zero = unsafe { zero.assume_init() };\n \n@@ -155,25 +155,25 @@\n This doesn\u2019t actually allocate if T
is zero-sized.
\n \u00a7Examples
\n \n-
Sourcepub fn try_new_in(x: T, alloc: A) -> Result<Self, AllocError>where\n+
Sourcepub fn try_new_in(x: T, alloc: A) -> Result<Self, AllocError>where\n A: Allocator,
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Allocates memory in the given allocator then places x
into it,\n returning an error if the allocation fails
\n This doesn\u2019t actually allocate if T
is zero-sized.
\n \u00a7Examples
\n \n-Sourcepub fn new_uninit_in(alloc: A) -> Box<MaybeUninit<T>, A>where\n+
Sourcepub fn new_uninit_in(alloc: A) -> Box<MaybeUninit<T>, A>where\n A: Allocator,
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new box with uninitialized contents in the provided allocator.
\n \u00a7Examples
\n \n-Sourcepub fn try_new_uninit_in(alloc: A) -> Result<Box<MaybeUninit<T>, A>, AllocError>where\n+
Sourcepub fn try_new_uninit_in(alloc: A) -> Result<Box<MaybeUninit<T>, A>, AllocError>where\n A: Allocator,
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new box with uninitialized contents in the provided allocator,\n returning an error if the allocation fails
\n \u00a7Examples
\n \n-Sourcepub fn new_zeroed_in(alloc: A) -> Box<MaybeUninit<T>, A>where\n+
Sourcepub fn new_zeroed_in(alloc: A) -> Box<MaybeUninit<T>, A>where\n A: Allocator,
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new Box
with uninitialized contents, with the memory\n being filled with 0
bytes in the provided allocator.
\n-See MaybeUninit::zeroed
for examples of correct and incorrect usage\n+
See MaybeUninit::zeroed
for examples of correct and incorrect usage\n of this method.
\n \u00a7Examples
\n \n-Sourcepub fn try_new_zeroed_in(alloc: A) -> Result<Box<MaybeUninit<T>, A>, AllocError>where\n+
Sourcepub fn try_new_zeroed_in(alloc: A) -> Result<Box<MaybeUninit<T>, A>, AllocError>where\n A: Allocator,
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new Box
with uninitialized contents, with the memory\n being filled with 0
bytes in the provided allocator,\n returning an error if the allocation fails,
\n-See MaybeUninit::zeroed
for examples of correct and incorrect usage\n+
See MaybeUninit::zeroed
for examples of correct and incorrect usage\n of this method.
\n \u00a7Examples
\n \n-Sourcepub fn pin_in(x: T, alloc: A) -> Pin<Self>where\n- A: 'static + Allocator,
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new Pin<Box<T, A>>
. If T
does not implement Unpin
, then\n+
Sourcepub fn pin_in(x: T, alloc: A) -> Pin<Self>where\n+ A: 'static + Allocator,
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new Pin<Box<T, A>>
. If T
does not implement Unpin
, then\n x
will be pinned in memory and unable to be moved.
\n Constructing and pinning of the Box
can also be done in two steps: Box::pin_in(x, alloc)
\n does the same as Box::into_pin(Box::new_in(x, alloc))
. Consider using\n into_pin
if you already have a Box<T, A>
, or if you want to\n construct a (pinned) Box
in a different way than with Box::new_in
.
\n-Sourcepub fn into_boxed_slice(boxed: Self) -> Box<[T], A>
\ud83d\udd2cThis is a nightly-only experimental API. (box_into_boxed_slice
#71582)
Converts a Box<T>
into a Box<[T]>
\n+Sourcepub fn into_boxed_slice(boxed: Self) -> Box<[T], A>
\ud83d\udd2cThis is a nightly-only experimental API. (box_into_boxed_slice
#71582)
Converts a Box<T>
into a Box<[T]>
\n This conversion does not allocate on the heap and happens in place.
\n Sourcepub fn into_inner(boxed: Self) -> T
\ud83d\udd2cThis is a nightly-only experimental API. (box_into_inner
#80437)
Consumes the Box
, returning the wrapped value.
\n \u00a7Examples
\n \n-Source\u00a7impl<T> Box<[T]>
1.82.0 \u00b7 Sourcepub fn new_uninit_slice(len: usize) -> Box<[MaybeUninit<T>]>
Constructs a new boxed slice with uninitialized contents.
\n+Source\u00a7impl<T> Box<[T]>
1.82.0 \u00b7 Sourcepub fn new_uninit_slice(len: usize) -> Box<[MaybeUninit<T>]>
Constructs a new boxed slice with uninitialized contents.
\n \u00a7Examples
\n \n-Sourcepub fn new_zeroed_slice(len: usize) -> Box<[MaybeUninit<T>]>
\ud83d\udd2cThis is a nightly-only experimental API. (new_zeroed_alloc
#129396)
Constructs a new boxed slice with uninitialized contents, with the memory\n+
Sourcepub fn new_zeroed_slice(len: usize) -> Box<[MaybeUninit<T>]>
\ud83d\udd2cThis is a nightly-only experimental API. (new_zeroed_alloc
#129396)
Constructs a new boxed slice with uninitialized contents, with the memory\n being filled with 0
bytes.
\n-See MaybeUninit::zeroed
for examples of correct and incorrect usage\n+
See MaybeUninit::zeroed
for examples of correct and incorrect usage\n of this method.
\n \u00a7Examples
\n \n Sourcepub fn try_new_uninit_slice(\n- len: usize,\n-) -> Result<Box<[MaybeUninit<T>]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents. Returns an error if\n+ len: usize,\n+) -> Result<Box<[MaybeUninit<T>]>, AllocError>\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents. Returns an error if\n the allocation fails.
\n \u00a7Examples
\n #![feature(allocator_api)]\n \n let mut values = Box::<[u32]>::try_new_uninit_slice(3)?;\n let values = unsafe {\n // Deferred initialization:\n@@ -288,30 +288,30 @@\n values[1].as_mut_ptr().write(2);\n values[2].as_mut_ptr().write(3);\n values.assume_init()\n };\n \n assert_eq!(*values, [1, 2, 3]);
\n Sourcepub fn try_new_zeroed_slice(\n- len: usize,\n-) -> Result<Box<[MaybeUninit<T>]>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents, with the memory\n+ len: usize,\n+) -> Result<Box<[MaybeUninit<T>]>, AllocError>\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents, with the memory\n being filled with 0
bytes. Returns an error if the allocation fails.
\n-See MaybeUninit::zeroed
for examples of correct and incorrect usage\n+
See MaybeUninit::zeroed
for examples of correct and incorrect usage\n of this method.
\n \u00a7Examples
\n \n-Sourcepub fn into_array<const N: usize>(self) -> Option<Box<[T; N]>>
\ud83d\udd2cThis is a nightly-only experimental API. (slice_as_array
#133508)
Converts the boxed slice into a boxed array.
\n+Sourcepub fn into_array<const N: usize>(self) -> Option<Box<[T; N]>>
\ud83d\udd2cThis is a nightly-only experimental API. (slice_as_array
#133508)
Converts the boxed slice into a boxed array.
\n This operation does not reallocate; the underlying array of the slice is simply reinterpreted as an array type.
\n If N
is not exactly equal to the length of self
, then this method returns None
.
\n-Source\u00a7impl<T, A: Allocator> Box<[T], A>
Sourcepub fn new_uninit_slice_in(len: usize, alloc: A) -> Box<[MaybeUninit<T>], A>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents in the provided allocator.
\n+Source\u00a7impl<T, A: Allocator> Box<[T], A>
Sourcepub fn new_uninit_slice_in(len: usize, alloc: A) -> Box<[MaybeUninit<T>], A>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents in the provided allocator.
\n \u00a7Examples
\n \n-Sourcepub fn new_zeroed_slice_in(len: usize, alloc: A) -> Box<[MaybeUninit<T>], A>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents in the provided allocator,\n+
Sourcepub fn new_zeroed_slice_in(len: usize, alloc: A) -> Box<[MaybeUninit<T>], A>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents in the provided allocator,\n with the memory being filled with 0
bytes.
\n-See MaybeUninit::zeroed
for examples of correct and incorrect usage\n+
See MaybeUninit::zeroed
for examples of correct and incorrect usage\n of this method.
\n \u00a7Examples
\n \n Sourcepub fn try_new_uninit_slice_in(\n- len: usize,\n+ len: usize,\n alloc: A,\n-) -> Result<Box<[MaybeUninit<T>], A>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents in the provided allocator. Returns an error if\n+) -> Result<Box<[MaybeUninit<T>], A>, AllocError>\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents in the provided allocator. Returns an error if\n the allocation fails.
\n \u00a7Examples
\n \n Sourcepub fn try_new_zeroed_slice_in(\n- len: usize,\n+ len: usize,\n alloc: A,\n-) -> Result<Box<[MaybeUninit<T>], A>, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents in the provided allocator, with the memory\n+) -> Result<Box<[MaybeUninit<T>], A>, AllocError>\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a new boxed slice with uninitialized contents in the provided allocator, with the memory\n being filled with 0
bytes. Returns an error if the allocation fails.
\n-See MaybeUninit::zeroed
for examples of correct and incorrect usage\n+
See MaybeUninit::zeroed
for examples of correct and incorrect usage\n of this method.
\n \u00a7Examples
\n \n-Source\u00a7impl<T, A: Allocator> Box<MaybeUninit<T>, A>
1.82.0 \u00b7 Sourcepub unsafe fn assume_init(self) -> Box<T, A>
Converts to Box<T, A>
.
\n+Source\u00a7impl<T, A: Allocator> Box<MaybeUninit<T>, A>
1.82.0 \u00b7 Sourcepub unsafe fn assume_init(self) -> Box<T, A>
Converts to Box<T, A>
.
\n \u00a7Safety
\n-As with MaybeUninit::assume_init
,\n+
As with MaybeUninit::assume_init
,\n it is up to the caller to guarantee that the value\n really is in an initialized state.\n Calling this when the content is not yet fully initialized\n causes immediate undefined behavior.
\n \u00a7Examples
\n \n-Source\u00a7impl<T, A: Allocator> Box<[MaybeUninit<T>], A>
1.82.0 \u00b7 Sourcepub unsafe fn assume_init(self) -> Box<[T], A>
Converts to Box<[T], A>
.
\n+Source\u00a7impl<T, A: Allocator> Box<[MaybeUninit<T>], A>
1.82.0 \u00b7 Sourcepub unsafe fn assume_init(self) -> Box<[T], A>
Converts to Box<[T], A>
.
\n \u00a7Safety
\n-As with MaybeUninit::assume_init
,\n+
As with MaybeUninit::assume_init
,\n it is up to the caller to guarantee that the values\n really are in an initialized state.\n Calling this when the content is not yet fully initialized\n causes immediate undefined behavior.
\n \u00a7Examples
\n \n-Source\u00a7impl<T: ?Sized> Box<T>
1.4.0 \u00b7 Sourcepub unsafe fn from_raw(raw: *mut T) -> Self
Constructs a box from a raw pointer.
\n After calling this function, the raw pointer is owned by the\n resulting Box
. Specifically, the Box
destructor will call\n the destructor of T
and free the allocated memory. For this\n to be safe, the memory must have been allocated in accordance\n with the memory layout used by Box
.
\n \u00a7Safety
\n This function is unsafe because improper use may lead to\n@@ -461,15 +461,15 @@\n let ptr = alloc(Layout::new::<i32>()) as *mut i32;\n // In general .write is required to avoid attempting to destruct\n // the (uninitialized) previous contents of `ptr`, though for this\n // simple example `*ptr = 5` would have worked as well.\n ptr.write(5);\n let x = Box::from_raw(ptr);\n }
\n-Sourcepub unsafe fn from_non_null(ptr: NonNull<T>) -> Self
\ud83d\udd2cThis is a nightly-only experimental API. (box_vec_non_null
#130364)
Constructs a box from a NonNull
pointer.
\n+Sourcepub unsafe fn from_non_null(ptr: NonNull<T>) -> Self
\ud83d\udd2cThis is a nightly-only experimental API. (box_vec_non_null
#130364)
Constructs a box from a NonNull
pointer.
\n After calling this function, the NonNull
pointer is owned by\n the resulting Box
. Specifically, the Box
destructor will call\n the destructor of T
and free the allocated memory. For this\n to be safe, the memory must have been allocated in accordance\n with the memory layout used by Box
.
\n \u00a7Safety
\n This function is unsafe because improper use may lead to\n@@ -496,15 +496,15 @@\n let non_null = NonNull::new(alloc(Layout::new::<i32>()).cast::<i32>())\n .expect(\"allocation failed\");\n // In general .write is required to avoid attempting to destruct\n // the (uninitialized) previous contents of `non_null`.\n non_null.write(5);\n let x = Box::from_non_null(non_null);\n }
\n-Source\u00a7impl<T: ?Sized, A: Allocator> Box<T, A>
Sourcepub const unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Self
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a box from a raw pointer in the given allocator.
\n+Source\u00a7impl<T: ?Sized, A: Allocator> Box<T, A>
Sourcepub const unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Self
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a box from a raw pointer in the given allocator.
\n After calling this function, the raw pointer is owned by the\n resulting Box
. Specifically, the Box
destructor will call\n the destructor of T
and free the allocated memory. For this\n to be safe, the memory must have been allocated in accordance\n with the memory layout used by Box
.
\n \u00a7Safety
\n This function is unsafe because improper use may lead to\n@@ -532,15 +532,15 @@\n let ptr = System.allocate(Layout::new::<i32>())?.as_mut_ptr() as *mut i32;\n // In general .write is required to avoid attempting to destruct\n // the (uninitialized) previous contents of `ptr`, though for this\n // simple example `*ptr = 5` would have worked as well.\n ptr.write(5);\n let x = Box::from_raw_in(ptr, System);\n }
\n-Sourcepub const unsafe fn from_non_null_in(raw: NonNull<T>, alloc: A) -> Self
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a box from a NonNull
pointer in the given allocator.
\n+Sourcepub const unsafe fn from_non_null_in(raw: NonNull<T>, alloc: A) -> Self
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Constructs a box from a NonNull
pointer in the given allocator.
\n After calling this function, the NonNull
pointer is owned by\n the resulting Box
. Specifically, the Box
destructor will call\n the destructor of T
and free the allocated memory. For this\n to be safe, the memory must have been allocated in accordance\n with the memory layout used by Box
.
\n \u00a7Safety
\n This function is unsafe because improper use may lead to\n@@ -566,15 +566,15 @@\n unsafe {\n let non_null = System.allocate(Layout::new::<i32>())?.cast::<i32>();\n // In general .write is required to avoid attempting to destruct\n // the (uninitialized) previous contents of `non_null`.\n non_null.write(5);\n let x = Box::from_non_null_in(non_null, System);\n }
\n-1.4.0 \u00b7 Sourcepub fn into_raw(b: Self) -> *mut T
Consumes the Box
, returning a wrapped raw pointer.
\n+1.4.0 \u00b7 Sourcepub fn into_raw(b: Self) -> *mut T
Consumes the Box
, returning a wrapped raw pointer.
\n The pointer will be properly aligned and non-null.
\n After calling this function, the caller is responsible for the\n memory previously managed by the Box
. In particular, the\n caller should properly destroy T
and release the memory, taking\n into account the memory layout used by Box
. The easiest way to\n do this is to convert the raw pointer back into a Box
with the\n Box::from_raw
function, allowing the Box
destructor to perform\n@@ -604,15 +604,15 @@\n
Note: This is equivalent to the following:
\n \n \n-Sourcepub fn into_non_null(b: Self) -> NonNull<T>
\ud83d\udd2cThis is a nightly-only experimental API. (box_vec_non_null
#130364)
Consumes the Box
, returning a wrapped NonNull
pointer.
\n+Sourcepub fn into_non_null(b: Self) -> NonNull<T>
\ud83d\udd2cThis is a nightly-only experimental API. (box_vec_non_null
#130364)
Consumes the Box
, returning a wrapped NonNull
pointer.
\n The pointer will be properly aligned.
\n After calling this function, the caller is responsible for the\n memory previously managed by the Box
. In particular, the\n caller should properly destroy T
and release the memory, taking\n into account the memory layout used by Box
. The easiest way to\n do this is to convert the NonNull
pointer back into a Box
with the\n Box::from_non_null
function, allowing the Box
destructor to\n@@ -647,15 +647,15 @@\n
\n-Sourcepub fn into_raw_with_allocator(b: Self) -> (*mut T, A)
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Consumes the Box
, returning a wrapped raw pointer and the allocator.
\n+Sourcepub fn into_raw_with_allocator(b: Self) -> (*mut T, A)
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Consumes the Box
, returning a wrapped raw pointer and the allocator.
\n The pointer will be properly aligned and non-null.
\n After calling this function, the caller is responsible for the\n memory previously managed by the Box
. In particular, the\n caller should properly destroy T
and release the memory, taking\n into account the memory layout used by Box
. The easiest way to\n do this is to convert the raw pointer back into a Box
with the\n Box::from_raw_in
function, allowing the Box
destructor to perform\n@@ -685,15 +685,15 @@\n let x = Box::new_in(String::from(\"Hello\"), System);\n let (ptr, alloc) = Box::into_raw_with_allocator(x);\n unsafe {\n ptr::drop_in_place(ptr);\n let non_null = NonNull::new_unchecked(ptr);\n alloc.deallocate(non_null.cast(), Layout::new::<String>());\n }
\n-Sourcepub fn into_non_null_with_allocator(b: Self) -> (NonNull<T>, A)
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Consumes the Box
, returning a wrapped NonNull
pointer and the allocator.
\n+Sourcepub fn into_non_null_with_allocator(b: Self) -> (NonNull<T>, A)
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Consumes the Box
, returning a wrapped NonNull
pointer and the allocator.
\n The pointer will be properly aligned.
\n After calling this function, the caller is responsible for the\n memory previously managed by the Box
. In particular, the\n caller should properly destroy T
and release the memory, taking\n into account the memory layout used by Box
. The easiest way to\n do this is to convert the NonNull
pointer back into a Box
with the\n Box::from_non_null_in
function, allowing the Box
destructor to\n@@ -722,15 +722,15 @@\n \n let x = Box::new_in(String::from(\"Hello\"), System);\n let (non_null, alloc) = Box::into_non_null_with_allocator(x);\n unsafe {\n non_null.drop_in_place();\n alloc.deallocate(non_null.cast::<u8>(), Layout::new::<String>());\n }
\n-Sourcepub fn as_mut_ptr(b: &mut Self) -> *mut T
\ud83d\udd2cThis is a nightly-only experimental API. (box_as_ptr
#129090)
Returns a raw mutable pointer to the Box
\u2019s contents.
\n+Sourcepub fn as_mut_ptr(b: &mut Self) -> *mut T
\ud83d\udd2cThis is a nightly-only experimental API. (box_as_ptr
#129090)
Returns a raw mutable pointer to the Box
\u2019s contents.
\n The caller must ensure that the Box
outlives the pointer this\n function returns, or else it will end up dangling.
\n This method guarantees that for the purpose of the aliasing model, this method\n does not materialize a reference to the underlying memory, and thus the returned pointer\n will remain valid when mixed with other calls to as_ptr
and as_mut_ptr
.\n Note that calling other methods that materialize references to the memory\n may still invalidate this pointer.\n@@ -745,15 +745,15 @@\n let ptr1 = Box::as_mut_ptr(&mut b);\n ptr1.write(1);\n let ptr2 = Box::as_mut_ptr(&mut b);\n ptr2.write(2);\n // Notably, the write to `ptr2` did *not* invalidate `ptr1`:\n ptr1.write(3);\n }
\n-Sourcepub fn as_ptr(b: &Self) -> *const T
\ud83d\udd2cThis is a nightly-only experimental API. (box_as_ptr
#129090)
Returns a raw pointer to the Box
\u2019s contents.
\n+Sourcepub fn as_ptr(b: &Self) -> *const T
\ud83d\udd2cThis is a nightly-only experimental API. (box_as_ptr
#129090)
Returns a raw pointer to the Box
\u2019s contents.
\n The caller must ensure that the Box
outlives the pointer this\n function returns, or else it will end up dangling.
\n The caller must also ensure that the memory the pointer (non-transitively) points to\n is never written to (except inside an UnsafeCell
) using this pointer or any pointer\n derived from it. If you need to mutate the contents of the Box
, use as_mut_ptr
.
\n This method guarantees that for the purpose of the aliasing model, this method\n does not materialize a reference to the underlying memory, and thus the returned pointer\n@@ -774,19 +774,19 @@\n // No write to this memory has happened yet, so `ptr1` is still valid.\n let _val = ptr1.read();\n // However, once we do a write...\n ptr2.write(1);\n // ... `ptr1` is no longer valid.\n // This would be UB: let _val = ptr1.read();\n }
\n-Sourcepub const fn allocator(b: &Self) -> &A
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Returns a reference to the underlying allocator.
\n+Sourcepub const fn allocator(b: &Self) -> &A
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
Returns a reference to the underlying allocator.
\n Note: this is an associated function, which means that you have\n to call it as Box::allocator(&b)
instead of b.allocator()
. This\n is so that there is no conflict with a method on the inner type.
\n-1.26.0 \u00b7 Sourcepub fn leak<'a>(b: Self) -> &'a mut Twhere\n A: 'a,
Consumes and leaks the Box
, returning a mutable reference,\n &'a mut T
.
\n Note that the type T
must outlive the chosen lifetime 'a
. If the type\n has only static references, or none at all, then this may be chosen to be\n 'static
.
\n This function is mainly useful for data that lives for the remainder of\n the program\u2019s life. Dropping the returned reference will cause a memory\n@@ -806,19 +806,19 @@\n assert_eq!(*static_ref, 42);
\n Unsized data:
\n \n \n-1.63.0 (const: unstable) \u00b7 Sourcepub fn into_pin(boxed: Self) -> Pin<Self>where\n- A: 'static,
Converts a Box<T>
into a Pin<Box<T>>
. If T
does not implement Unpin
, then\n+
1.63.0 (const: unstable) \u00b7 Sourcepub fn into_pin(boxed: Self) -> Pin<Self>where\n+ A: 'static,
Converts a Box<T>
into a Pin<Box<T>>
. If T
does not implement Unpin
, then\n *boxed
will be pinned in memory and unable to be moved.
\n This conversion does not allocate on the heap and happens in place.
\n-This is also available via From
.
\n+This is also available via From
.
\n Constructing and pinning a Box
with Box::into_pin(Box::new(x))
\n can also be written more concisely using Box::pin(x)
.\n This into_pin
method is useful if you already have a Box<T>
, or you are\n constructing a (pinned) Box
in a different way than with Box::new
.
\n \u00a7Notes
\n It\u2019s not recommended that crates add an impl like From<Box<T>> for Pin<T>
,\n as it\u2019ll introduce an ambiguity when calling Pin::from
.\n@@ -829,231 +829,231 @@\n fn from(_: Box<()>) -> Pin<Foo> {\n Pin::new(Foo)\n }\n }\n \n let foo = Box::new(());\n let bar = Pin::from(foo);
\n-Trait Implementations\u00a7
Trait Implementations\u00a7
1.85.0 \u00b7 Source\u00a7impl<Args: Tuple, F: AsyncFn<Args> + ?Sized, A: Allocator> AsyncFn<Args> for Box<F, A>
Source\u00a7extern "rust-call" fn async_call(\n &self,\n args: Args,\n-) -> Self::CallRefFuture<'_>
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Call the AsyncFn
, returning a future which may borrow from the called closure.1.85.0 \u00b7 Source\u00a7impl<Args: Tuple, F: AsyncFnMut<Args> + ?Sized, A: Allocator> AsyncFnMut<Args> for Box<F, A>
Source\u00a7type CallRefFuture<'a> = <F as AsyncFnMut<Args>>::CallRefFuture<'a>\n+) -> Self::CallRefFuture<'_>
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Call the AsyncFn
, returning a future which may borrow from the called closure.1.85.0 \u00b7 Source\u00a7impl<Args: Tuple, F: AsyncFnMut<Args> + ?Sized, A: Allocator> AsyncFnMut<Args> for Box<F, A>
Source\u00a7type CallRefFuture<'a> = <F as AsyncFnMut<Args>>::CallRefFuture<'a>\n where\n- Self: 'a
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Future returned by AsyncFnMut::async_call_mut
and AsyncFn::async_call
.Source\u00a7extern "rust-call" fn async_call_mut(\n+ Self: 'a
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Future returned by AsyncFnMut::async_call_mut
and AsyncFn::async_call
.Source\u00a7extern "rust-call" fn async_call_mut(\n &mut self,\n args: Args,\n-) -> Self::CallRefFuture<'_>
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Call the AsyncFnMut
, returning a future which may borrow from the called closure.1.85.0 \u00b7 Source\u00a7impl<Args: Tuple, F: AsyncFnOnce<Args> + ?Sized, A: Allocator> AsyncFnOnce<Args> for Box<F, A>
Source\u00a7type Output = <F as AsyncFnOnce<Args>>::Output
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Output type of the called closure\u2019s future.Source\u00a7type CallOnceFuture = <F as AsyncFnOnce<Args>>::CallOnceFuture
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Future returned by AsyncFnOnce::async_call_once
.Source\u00a7extern "rust-call" fn async_call_once(\n+) -> Self::CallRefFuture<'_>
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Call the AsyncFnMut
, returning a future which may borrow from the called closure.1.85.0 \u00b7 Source\u00a7impl<Args: Tuple, F: AsyncFnOnce<Args> + ?Sized, A: Allocator> AsyncFnOnce<Args> for Box<F, A>
Source\u00a7type Output = <F as AsyncFnOnce<Args>>::Output
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Output type of the called closure\u2019s future.Source\u00a7type CallOnceFuture = <F as AsyncFnOnce<Args>>::CallOnceFuture
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Future returned by AsyncFnOnce::async_call_once
.Source\u00a7extern "rust-call" fn async_call_once(\n self,\n args: Args,\n-) -> Self::CallOnceFuture
\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Call the AsyncFnOnce
, returning a future which may move out of the called closure.Source\u00a7impl<S: ?Sized + AsyncIterator + Unpin> AsyncIterator for Box<S>
Source\u00a7type Item = <S as AsyncIterator>::Item
\ud83d\udd2cThis is a nightly-only experimental API. (async_iterator
#79024)The type of items yielded by the async iterator.Source\u00a7fn poll_next(\n- self: Pin<&mut Self>,\n- cx: &mut Context<'_>,\n-) -> Poll<Option<Self::Item>>
\ud83d\udd2cThis is a nightly-only experimental API. (async_iterator
#79024)Attempts to pull out the next value of this async iterator, registering the\n+) -> Self::CallOnceFuture\ud83d\udd2cThis is a nightly-only experimental API. (async_fn_traits
)Call the AsyncFnOnce
, returning a future which may move out of the called closure.Source\u00a7impl<S: ?Sized + AsyncIterator + Unpin> AsyncIterator for Box<S>
Source\u00a7type Item = <S as AsyncIterator>::Item
\ud83d\udd2cThis is a nightly-only experimental API. (async_iterator
#79024)The type of items yielded by the async iterator.Source\u00a7fn poll_next(\n+ self: Pin<&mut Self>,\n+ cx: &mut Context<'_>,\n+) -> Poll<Option<Self::Item>>
\ud83d\udd2cThis is a nightly-only experimental API. (async_iterator
#79024)Attempts to pull out the next value of this async iterator, registering the\n current task for wakeup if the value is not yet available, and returning\n-None
if the async iterator is exhausted. Read more1.1.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> BorrowMut<T> for Box<T, A>
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more1.3.0 \u00b7 Source\u00a7impl<T: Clone, A: Allocator + Clone> Clone for Box<[T], A>
Source\u00a7fn clone_from(&mut self, source: &Self)
Copies source
\u2019s contents into self
without creating a new allocation,\n+None
if the async iterator is exhausted. Read more
1.1.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> BorrowMut<T> for Box<T, A>
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more1.3.0 \u00b7 Source\u00a7impl<T: Clone, A: Allocator + Clone> Clone for Box<[T], A>
Source\u00a7fn clone_from(&mut self, source: &Self)
Copies source
\u2019s contents into self
without creating a new allocation,\n so long as the two are of the same length.
\n \u00a7Examples
\n \n-1.0.0 \u00b7 Source\u00a7impl<T: Clone, A: Allocator + Clone> Clone for Box<T, A>
Source\u00a7fn clone(&self) -> Self
Returns a new box with a clone()
of this box\u2019s contents.
\n \u00a7Examples
\n \n-Source\u00a7fn clone_from(&mut self, source: &Self)
Copies source
\u2019s contents into self
without creating a new allocation.
\n+Source\u00a7fn clone_from(&mut self, source: &Self)
Copies source
\u2019s contents into self
without creating a new allocation.
\n \u00a7Examples
\n \n-Source\u00a7impl<G: ?Sized + Coroutine<R> + Unpin, R, A: Allocator> Coroutine<R> for Box<G, A>
Source\u00a7type Yield = <G as Coroutine<R>>::Yield
\ud83d\udd2cThis is a nightly-only experimental API. (coroutine_trait
#43122)The type of value this coroutine yields. Read moreSource\u00a7impl<G: ?Sized + Coroutine<R> + Unpin, R, A: Allocator> Coroutine<R> for Box<G, A>
Source\u00a7type Yield = <G as Coroutine<R>>::Yield
\ud83d\udd2cThis is a nightly-only experimental API. (coroutine_trait
#43122)The type of value this coroutine yields. Read moreSource\u00a7impl<G: ?Sized + Coroutine<R>, R, A> Coroutine<R> for Pin<Box<G, A>>where\n- A: 'static + Allocator,
Source\u00a7type Yield = <G as Coroutine<R>>::Yield
\ud83d\udd2cThis is a nightly-only experimental API. (coroutine_trait
#43122)The type of value this coroutine yields. Read moreSource\u00a7impl<G: ?Sized + Coroutine<R>, R, A> Coroutine<R> for Pin<Box<G, A>>where\n+ A: 'static + Allocator,
Source\u00a7type Yield = <G as Coroutine<R>>::Yield
\ud83d\udd2cThis is a nightly-only experimental API. (coroutine_trait
#43122)The type of value this coroutine yields. Read more1.0.0 \u00b7 Source\u00a7impl<I: DoubleEndedIterator + ?Sized, A: Allocator> DoubleEndedIterator for Box<I, A>
Source\u00a7fn next_back(&mut self) -> Option<I::Item>
Removes and returns an element from the end of the iterator. Read moreSource\u00a7fn nth_back(&mut self, n: usize) -> Option<I::Item>
Returns the n
th element from the end of the iterator. Read moreSource\u00a7fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_advance_by
#77404)Advances the iterator from the back by n
elements. Read more1.27.0 \u00b7 Source\u00a7fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
This is the reverse version of Iterator::try_fold()
: it takes\n-elements starting from the back of the iterator. Read more1.8.0 \u00b7 Source\u00a7impl<E: Error> Error for Box<E>
Source\u00a7fn description(&self) -> &str
\ud83d\udc4eDeprecated since 1.42.0: use the Display impl or to_string()Source\u00a7fn cause(&self) -> Option<&dyn Error>
\ud83d\udc4eDeprecated since 1.33.0: replaced by Error::source, which can support downcasting1.0.0 \u00b7 Source\u00a7impl<I: ExactSizeIterator + ?Sized, A: Allocator> ExactSizeIterator for Box<I, A>
1.45.0 \u00b7 Source\u00a7impl<A: Allocator> Extend<Box<str, A>> for String
Source\u00a7fn extend<I: IntoIterator<Item = Box<str, A>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read moreSource\u00a7fn extend_one(&mut self, item: A)
\ud83d\udd2cThis is a nightly-only experimental API. (extend_one
#72631)Extends a collection with exactly one element.1.35.0 \u00b7 Source\u00a7impl<Args: Tuple, F: Fn<Args> + ?Sized, A: Allocator> Fn<Args> for Box<F, A>
1.35.0 \u00b7 Source\u00a7impl<Args: Tuple, F: FnMut<Args> + ?Sized, A: Allocator> FnMut<Args> for Box<F, A>
1.35.0 \u00b7 Source\u00a7impl<Args: Tuple, F: FnOnce<Args> + ?Sized, A: Allocator> FnOnce<Args> for Box<F, A>
1.17.0 \u00b7 Source\u00a7impl<T: Clone> From<&[T]> for Box<[T]>
Source\u00a7fn from(slice: &[T]) -> Box<[T]>
Converts a &[T]
into a Box<[T]>
\n+) -> CoroutineState<Self::Yield, Self::Return>\ud83d\udd2cThis is a nightly-only experimental API. (coroutine_trait
#43122)Resumes the execution of this coroutine. Read more1.0.0 \u00b7 Source\u00a7impl<I: DoubleEndedIterator + ?Sized, A: Allocator> DoubleEndedIterator for Box<I, A>
Source\u00a7fn next_back(&mut self) -> Option<I::Item>
Removes and returns an element from the end of the iterator. Read moreSource\u00a7fn nth_back(&mut self, n: usize) -> Option<I::Item>
Returns the n
th element from the end of the iterator. Read moreSource\u00a7fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_advance_by
#77404)Advances the iterator from the back by n
elements. Read more1.27.0 \u00b7 Source\u00a7fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
This is the reverse version of Iterator::try_fold()
: it takes\n+elements starting from the back of the iterator. Read more1.8.0 \u00b7 Source\u00a7impl<E: Error> Error for Box<E>
Source\u00a7fn description(&self) -> &str
\ud83d\udc4eDeprecated since 1.42.0: use the Display impl or to_string()Source\u00a7fn cause(&self) -> Option<&dyn Error>
\ud83d\udc4eDeprecated since 1.33.0: replaced by Error::source, which can support downcasting1.0.0 \u00b7 Source\u00a7impl<I: ExactSizeIterator + ?Sized, A: Allocator> ExactSizeIterator for Box<I, A>
1.45.0 \u00b7 Source\u00a7impl<A: Allocator> Extend<Box<str, A>> for String
Source\u00a7fn extend<I: IntoIterator<Item = Box<str, A>>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read moreSource\u00a7fn extend_one(&mut self, item: A)
\ud83d\udd2cThis is a nightly-only experimental API. (extend_one
#72631)Extends a collection with exactly one element.1.35.0 \u00b7 Source\u00a7impl<Args: Tuple, F: Fn<Args> + ?Sized, A: Allocator> Fn<Args> for Box<F, A>
1.35.0 \u00b7 Source\u00a7impl<Args: Tuple, F: FnMut<Args> + ?Sized, A: Allocator> FnMut<Args> for Box<F, A>
1.35.0 \u00b7 Source\u00a7impl<Args: Tuple, F: FnOnce<Args> + ?Sized, A: Allocator> FnOnce<Args> for Box<F, A>
1.17.0 \u00b7 Source\u00a7impl<T: Clone> From<&[T]> for Box<[T]>
1.84.0 \u00b7 Source\u00a7impl<T: Clone> From<&mut [T]> for Box<[T]>
1.84.0 \u00b7 Source\u00a7impl From<&mut str> for Box<str>
1.6.0 \u00b7 Source\u00a7impl<'a> From<&str> for Box<dyn Error + 'a>
1.0.0 \u00b7 Source\u00a7impl<'a> From<&str> for Box<dyn Error + Send + Sync + 'a>
1.33.0 \u00b7 Source\u00a7impl<T: ?Sized, A> From<Box<T, A>> for Pin<Box<T, A>>where\n- A: 'static + Allocator,
1.33.0 \u00b7 Source\u00a7impl<T: ?Sized, A> From<Box<T, A>> for Pin<Box<T, A>>where\n+ A: 'static + Allocator,
Source\u00a7fn from(boxed: Box<T, A>) -> Self
Converts a Box<T>
into a Pin<Box<T>>
. If T
does not implement Unpin
, then\n *boxed
will be pinned in memory and unable to be moved.
\n This conversion does not allocate on the heap and happens in place.
\n This is also available via Box::into_pin
.
\n Constructing and pinning a Box
with <Pin<Box<T>>>::from(Box::new(x))
\n can also be written more concisely using Box::pin(x)
.\n This From
implementation is useful if you already have a Box<T>
, or you are\n constructing a (pinned) Box
in a different way than with Box::new
.
\n-1.19.0 \u00b7 Source\u00a7impl<A: Allocator> From<Box<str, A>> for Box<[u8], A>
Source\u00a7fn from(s: Box<str, A>) -> Self
Converts a Box<str>
into a Box<[u8]>
\n This conversion does not allocate on the heap and happens in place.
\n \u00a7Examples
\n // create a Box<str> which will be used to create a Box<[u8]>\n let boxed: Box<str> = Box::from(\"hello\");\n let boxed_str: Box<[u8]> = Box::from(boxed);\n \n // create a &[u8] which will be used to create a Box<[u8]>\n let slice: &[u8] = &[104, 101, 108, 108, 111];\n let boxed_slice = Box::from(slice);\n \n assert_eq!(boxed_slice, boxed_str);
\n-1.45.0 \u00b7 Source\u00a7impl From<Cow<'_, str>> for Box<str>
Source\u00a7fn from(cow: Cow<'_, str>) -> Box<str>
Converts a Cow<'_, str>
into a Box<str>
\n When cow
is the Cow::Borrowed
variant, this\n conversion allocates on the heap and copies the\n underlying str
. Otherwise, it will try to reuse the owned\n String
\u2019s allocation.
\n \u00a7Examples
\n \n \n \n-1.22.0 \u00b7 Source\u00a7impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + 'a>
1.22.0 \u00b7 Source\u00a7impl<'a, 'b> From<Cow<'b, str>> for Box<dyn Error + Send + Sync + 'a>
1.0.0 \u00b7 Source\u00a7impl<'a, E: Error + 'a> From<E> for Box<dyn Error + 'a>
Source\u00a7fn from(err: E) -> Box<dyn Error + 'a>
Converts a type of Error
into a box of dyn Error
.
\n \u00a7Examples
\n use std::error::Error;\n use std::fmt;\n use std::mem;\n \n #[derive(Debug)]\n struct AnError;\n@@ -1066,16 +1066,16 @@\n \n impl Error for AnError {}\n \n let an_error = AnError;\n assert!(0 == mem::size_of_val(&an_error));\n let a_boxed_error = Box::<dyn Error>::from(an_error);\n assert!(mem::size_of::<Box<dyn Error>>() == mem::size_of_val(&a_boxed_error))
\n-1.0.0 \u00b7 Source\u00a7impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + 'a>
1.0.0 \u00b7 Source\u00a7impl<'a, E: Error + Send + Sync + 'a> From<E> for Box<dyn Error + Send + Sync + 'a>
Source\u00a7fn from(err: E) -> Box<dyn Error + Send + Sync + 'a>
Converts a type of Error
+ Send
+ Sync
into a box of\n+dyn Error
+ Send
+ Sync
.
\n \u00a7Examples
\n use std::error::Error;\n use std::fmt;\n use std::mem;\n \n #[derive(Debug)]\n struct AnError;\n@@ -1093,321 +1093,321 @@\n unsafe impl Sync for AnError {}\n \n let an_error = AnError;\n assert!(0 == mem::size_of_val(&an_error));\n let a_boxed_error = Box::<dyn Error + Send + Sync>::from(an_error);\n assert!(\n mem::size_of::<Box<dyn Error + Send + Sync>>() == mem::size_of_val(&a_boxed_error))
\n-1.6.0 \u00b7 Source\u00a7impl<'a> From<String> for Box<dyn Error + 'a>
1.0.0 \u00b7 Source\u00a7impl<'a> From<String> for Box<dyn Error + Send + Sync + 'a>
1.20.0 \u00b7 Source\u00a7impl<T, A: Allocator> From<Vec<T, A>> for Box<[T], A>
1.32.0 \u00b7 Source\u00a7impl<I> FromIterator<I> for Box<[I]>
Source\u00a7fn from_iter<T: IntoIterator<Item = I>>(iter: T) -> Self
Creates a value from an iterator. Read more1.22.0 \u00b7 Source\u00a7impl<T: ?Sized + Hasher, A: Allocator> Hasher for Box<T, A>
Source\u00a7fn write_u128(&mut self, i: u128)
Writes a single u128
into this hasher.Source\u00a7fn write_usize(&mut self, i: usize)
Writes a single usize
into this hasher.Source\u00a7fn write_i128(&mut self, i: i128)
Writes a single i128
into this hasher.Source\u00a7fn write_isize(&mut self, i: isize)
Writes a single isize
into this hasher.1.0.0 \u00b7 Source\u00a7impl<I: Iterator + ?Sized, A: Allocator> Iterator for Box<I, A>
Source\u00a7fn next(&mut self) -> Option<I::Item>
Advances the iterator and returns the next value. Read moreSource\u00a7fn size_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. Read moreSource\u00a7fn nth(&mut self, n: usize) -> Option<I::Item>
Returns the n
th element of the iterator. Read moreSource\u00a7fn last(self) -> Option<I::Item>
Consumes the iterator, returning the last element. Read moreSource\u00a7fn next_chunk<const N: usize>(\n+
1.32.0 \u00b7 Source\u00a7impl<I> FromIterator<I> for Box<[I]>
Source\u00a7fn from_iter<T: IntoIterator<Item = I>>(iter: T) -> Self
Creates a value from an iterator. Read more1.22.0 \u00b7 Source\u00a7impl<T: ?Sized + Hasher, A: Allocator> Hasher for Box<T, A>
Source\u00a7fn write_u128(&mut self, i: u128)
Writes a single u128
into this hasher.Source\u00a7fn write_usize(&mut self, i: usize)
Writes a single usize
into this hasher.Source\u00a7fn write_i128(&mut self, i: i128)
Writes a single i128
into this hasher.Source\u00a7fn write_isize(&mut self, i: isize)
Writes a single isize
into this hasher.1.0.0 \u00b7 Source\u00a7impl<I: Iterator + ?Sized, A: Allocator> Iterator for Box<I, A>
Source\u00a7fn next(&mut self) -> Option<I::Item>
Advances the iterator and returns the next value. Read moreSource\u00a7fn size_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. Read moreSource\u00a7fn nth(&mut self, n: usize) -> Option<I::Item>
Returns the n
th element of the iterator. Read moreSource\u00a7fn last(self) -> Option<I::Item>
Consumes the iterator, returning the last element. Read moreSource\u00a7fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_next_chunk
#98326)Advances the iterator and returns an array containing the next N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n- Self: Sized,
Consumes the iterator, counting the number of iterations and returning it. Read moreSource\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_advance_by
#77404)Advances the iterator by n
elements. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
Creates an iterator starting at the same point, but stepping by\n-the given amount at each iteration. Read more1.0.0 \u00b7 Source\u00a7fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
Takes two iterators and creates a new iterator over both in sequence. Read more1.0.0 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
\u2018Zips up\u2019 two iterators into a single iterator of pairs. Read moreSource\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places a copy of separator
between adjacent\n-items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places an item generated by separator
\n-between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
Takes a closure and creates an iterator which calls that closure on each\n-element. Read more1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
Calls a closure on each element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
Creates an iterator which uses a closure to determine if an element\n-should be yielded. Read more1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
Creates an iterator that both filters and maps. Read more1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
Creates an iterator which gives the current iteration count as well as\n-the next value. Read more1.0.0 \u00b7 Source\u00a7fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
Creates an iterator which can use the peek
and peek_mut
methods\n+) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n+ Self: Sized,\ud83d\udd2cThis is a nightly-only experimental API. (iter_next_chunk
#98326)Advances the iterator and returns an array containing the next N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n+ Self: Sized,
Consumes the iterator, counting the number of iterations and returning it. Read moreSource\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_advance_by
#77404)Advances the iterator by n
elements. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
Creates an iterator starting at the same point, but stepping by\n+the given amount at each iteration. Read more1.0.0 \u00b7 Source\u00a7fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
Takes two iterators and creates a new iterator over both in sequence. Read more1.0.0 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
\u2018Zips up\u2019 two iterators into a single iterator of pairs. Read moreSource\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places a copy of separator
between adjacent\n+items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places an item generated by separator
\n+between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
Takes a closure and creates an iterator which calls that closure on each\n+element. Read more1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
Calls a closure on each element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
Creates an iterator which uses a closure to determine if an element\n+should be yielded. Read more1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
Creates an iterator that both filters and maps. Read more1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
Creates an iterator which gives the current iteration count as well as\n+the next value. Read more1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Creates an iterator that yields elements based on a predicate. Read more1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
Creates an iterator that both yields elements based on a predicate and maps. Read more1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
Creates an iterator that skips the first n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
Creates an iterator that yields the first n
elements, or fewer\n-if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Creates an iterator that works like map, but flattens nested structure. Read more1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
Creates an iterator that flattens nested structure. Read moreSource\u00a7fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_map_windows
#87155)Calls the given function f
for each contiguous window of size N
over\n-self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n-the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
Does something with each element of an iterator, passing the value on. Read more1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
Borrows an iterator, rather than consuming it. Read more1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
Transforms an iterator into a collection. Read moreSource\u00a7fn try_collect<B>(\n+their documentation for more information. Read more
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Creates an iterator that yields elements based on a predicate. Read more1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
Creates an iterator that both yields elements based on a predicate and maps. Read more1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
Creates an iterator that skips the first n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
Creates an iterator that yields the first n
elements, or fewer\n+if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Creates an iterator that works like map, but flattens nested structure. Read more1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
Creates an iterator that flattens nested structure. Read moreSource\u00a7fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_map_windows
#87155)Calls the given function f
for each contiguous window of size N
over\n+self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n+the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
Does something with each element of an iterator, passing the value on. Read more1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
Borrows an iterator, rather than consuming it. Read more1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
Transforms an iterator into a collection. Read moreSource\u00a7fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n-a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usizewhere\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryTypewhere\n+ Self: Sized,\n+ Self::Item: Try,\n+ <Self::Item as Try>::Residual: Residual<B>,\n+ B: FromIterator<<Self::Item as Try>::Output>,\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n+ Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n+ P: FnMut(&T) -> bool,\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n such that all those that return true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
Source\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n+such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n+successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n+iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n+returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n+operation. Read moreSource\u00a7fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_reduce
#87053)Reduces the elements to a single one by repeatedly applying a reducing operation. If the\n-closure returns a failure, the failure is propagated back to the caller immediately. Read more1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
Tests if every element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
Tests if any element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
Searches for an element of an iterator that satisfies a predicate. Read more1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
Applies function to the elements of iterator and returns\n-the first non-none result. Read moreSource\u00a7fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_reduce
#87053)Reduces the elements to a single one by repeatedly applying a reducing operation. If the\n+closure returns a failure, the failure is propagated back to the caller immediately. Read more1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
Tests if every element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
Tests if any element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
Searches for an element of an iterator that satisfies a predicate. Read more1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
Applies function to the elements of iterator and returns\n+the first non-none result. Read moreSource\u00a7fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (try_find
#63178)Applies function to the elements of iterator and returns\n-the first true result or the first error. Read more1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
Searches for an element in an iterator, returning its index. Read more1.0.0 \u00b7 Source\u00a7fn rposition<P>(&mut self, predicate: P) -> Option<usize>
Searches for an element in an iterator from the right, returning its\n-index. Read more1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
Returns the maximum element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
Returns the minimum element of an iterator. Read more1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the maximum value from the\n-specified function. Read more1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the maximum value with respect to the\n-specified comparison function. Read more1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the minimum value from the\n-specified function. Read more1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the minimum value with respect to the\n-specified comparison function. Read more1.0.0 \u00b7 Source\u00a7fn rev(self) -> Rev<Self>where\n- Self: Sized + DoubleEndedIterator,
Reverses an iterator\u2019s direction. Read more1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
Converts an iterator of pairs into a pair of containers. Read more1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
Creates an iterator which copies all of its elements. Read moreSource\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_array_chunks
#100450)Returns an iterator over N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
Iterates over the entire iterator, multiplying all the elements Read moreSource\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n-of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
Lexicographically compares the PartialOrd
elements of\n-this Iterator
with those of another. The comparison works like short-circuit\n+ f: impl FnMut(&Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere\n+ Self: Sized,\n+ R: Try<Output = bool>,\n+ <R as Try>::Residual: Residual<Option<Self::Item>>,\ud83d\udd2cThis is a nightly-only experimental API. (try_find
#63178)Applies function to the elements of iterator and returns\n+the first true result or the first error. Read more1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
Searches for an element in an iterator, returning its index. Read more1.0.0 \u00b7 Source\u00a7fn rposition<P>(&mut self, predicate: P) -> Option<usize>
Searches for an element in an iterator from the right, returning its\n+index. Read more1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
Returns the maximum element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
Returns the minimum element of an iterator. Read more1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the maximum value from the\n+specified function. Read more1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the maximum value with respect to the\n+specified comparison function. Read more1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the minimum value from the\n+specified function. Read more1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the minimum value with respect to the\n+specified comparison function. Read more1.0.0 \u00b7 Source\u00a7fn rev(self) -> Rev<Self>where\n+ Self: Sized + DoubleEndedIterator,
Reverses an iterator\u2019s direction. Read more1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
Converts an iterator of pairs into a pair of containers. Read more1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
Creates an iterator which copies all of its elements. Read moreSource\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_array_chunks
#100450)Returns an iterator over N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
Iterates over the entire iterator, multiplying all the elements Read moreSource\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n+of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
Lexicographically compares the PartialOrd
elements of\n+this Iterator
with those of another. The comparison works like short-circuit\n evaluation, returning a result without comparing the remaining elements.\n-As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n-of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
Checks if the elements of this iterator are sorted. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
Checks if the elements of this iterator are sorted using the given comparator function. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
Checks if the elements of this iterator are sorted using the given key extraction\n-function. Read more1.0.0 \u00b7 Source\u00a7impl<T: ?Sized + Ord, A: Allocator> Ord for Box<T, A>
1.21.0 \u00b7 Source\u00a7fn max(self, other: Self) -> Selfwhere\n- Self: Sized,
Compares and returns the maximum of two values. Read more1.0.0 \u00b7 Source\u00a7impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for Box<T, A>
1.43.0 \u00b7 Source\u00a7impl<T, const N: usize> TryFrom<Box<[T]>> for Box<[T; N]>
Source\u00a7fn try_from(boxed_slice: Box<[T]>) -> Result<Self, Self::Error>
Attempts to convert a Box<[T]>
into a Box<[T; N]>
.
\n+As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n+of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
Checks if the elements of this iterator are sorted. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
Checks if the elements of this iterator are sorted using the given comparator function. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
Checks if the elements of this iterator are sorted using the given key extraction\n+function. Read more1.0.0 \u00b7 Source\u00a7impl<T: ?Sized + Ord, A: Allocator> Ord for Box<T, A>
1.21.0 \u00b7 Source\u00a7fn max(self, other: Self) -> Selfwhere\n+ Self: Sized,
Compares and returns the maximum of two values. Read more1.0.0 \u00b7 Source\u00a7impl<T: ?Sized + PartialOrd, A: Allocator> PartialOrd for Box<T, A>
1.43.0 \u00b7 Source\u00a7impl<T, const N: usize> TryFrom<Box<[T]>> for Box<[T; N]>
Source\u00a7fn try_from(boxed_slice: Box<[T]>) -> Result<Self, Self::Error>
Attempts to convert a Box<[T]>
into a Box<[T; N]>
.
\n The conversion occurs in-place and does not require a\n new memory allocation.
\n \u00a7Errors
\n Returns the old Box<[T]>
in the Err
variant if\n boxed_slice.len()
does not equal N
.
\n-1.66.0 \u00b7 Source\u00a7impl<T, const N: usize> TryFrom<Vec<T>> for Box<[T; N]>
Source\u00a7fn try_from(vec: Vec<T>) -> Result<Self, Self::Error>
Attempts to convert a Vec<T>
into a Box<[T; N]>
.
\n Like Vec::into_boxed_slice
, this is in-place if vec.capacity() == N
,\n but will require a reallocation otherwise.
\n \u00a7Errors
\n Returns the original Vec<T>
in the Err
variant if\n boxed_slice.len()
does not equal N
.
\n \u00a7Examples
\n This can be used with vec!
to create an array on the heap:
\n \n \n-Source\u00a7impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A>
Source\u00a7impl<T: ?Sized, A: Allocator> DerefPure for Box<T, A>
Source\u00a7impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global>
1.0.0 \u00b7 Source\u00a7impl<T: ?Sized + Eq, A: Allocator> Eq for Box<T, A>
1.26.0 \u00b7 Source\u00a7impl<I: FusedIterator + ?Sized, A: Allocator> FusedIterator for Box<I, A>
1.80.0 \u00b7 Source\u00a7impl<'a, I, A: Allocator> !Iterator for &'a Box<[I], A>
This implementation is required to make sure that the &Box<[I]>: IntoIterator
\n+
Source\u00a7impl<T: ?Sized + Unsize<U>, U: ?Sized, A: Allocator> CoerceUnsized<Box<U, A>> for Box<T, A>
Source\u00a7impl<T: ?Sized, A: Allocator> DerefPure for Box<T, A>
Source\u00a7impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T, Global>
1.0.0 \u00b7 Source\u00a7impl<T: ?Sized + Eq, A: Allocator> Eq for Box<T, A>
1.26.0 \u00b7 Source\u00a7impl<I: FusedIterator + ?Sized, A: Allocator> FusedIterator for Box<I, A>
1.80.0 \u00b7 Source\u00a7impl<'a, I, A: Allocator> !Iterator for &'a Box<[I], A>
This implementation is required to make sure that the &Box<[I]>: IntoIterator
\n implementation doesn\u2019t overlap with IntoIterator for T where T: Iterator
blanket.
\n- 1.80.0 \u00b7 Source\u00a7impl<'a, I, A: Allocator> !Iterator for &'a mut Box<[I], A>
This implementation is required to make sure that the &mut Box<[I]>: IntoIterator
\n+
1.80.0 \u00b7 Source\u00a7impl<'a, I, A: Allocator> !Iterator for &'a mut Box<[I], A>
This implementation is required to make sure that the &mut Box<[I]>: IntoIterator
\n implementation doesn\u2019t overlap with IntoIterator for T where T: Iterator
blanket.
\n- 1.80.0 \u00b7 Source\u00a7impl<I, A: Allocator> !Iterator for Box<[I], A>
This implementation is required to make sure that the Box<[I]>: IntoIterator
\n+
1.80.0 \u00b7 Source\u00a7impl<I, A: Allocator> !Iterator for Box<[I], A>
This implementation is required to make sure that the Box<[I]>: IntoIterator
\n implementation doesn\u2019t overlap with IntoIterator for T where T: Iterator
blanket.
\n- Source\u00a7impl<T: ?Sized, A: Allocator> PinCoerceUnsized for Box<T, A>
Source\u00a7impl<T> PointerLike for Box<T>
1.33.0 \u00b7 Source\u00a7impl<T: ?Sized, A: Allocator> Unpin for Box<T, A>
Auto Trait Implementations\u00a7
\u00a7impl<T, A> Freeze for Box<T, A>
\u00a7impl<T, A> RefUnwindSafe for Box<T, A>
\u00a7impl<T, A> Send for Box<T, A>
\u00a7impl<T, A> Sync for Box<T, A>
\u00a7impl<T, A> UnwindSafe for Box<T, A>
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moreSource\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
Auto Trait Implementations\u00a7
\u00a7impl<T, A> Freeze for Box<T, A>
\u00a7impl<T, A> RefUnwindSafe for Box<T, A>
\u00a7impl<T, A> Send for Box<T, A>
\u00a7impl<T, A> Sync for Box<T, A>
\u00a7impl<T, A> UnwindSafe for Box<T, A>
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moreSource\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7impl<I> IntoAsyncIterator for Iwhere\n- I: AsyncIterator,
Source\u00a7type Item = <I as AsyncIterator>::Item
\ud83d\udd2cThis is a nightly-only experimental API. (async_iterator
#79024)The type of the item yielded by the iteratorSource\u00a7type IntoAsyncIter = I
\ud83d\udd2cThis is a nightly-only experimental API. (async_iterator
#79024)The type of the resulting iteratorSource\u00a7fn into_async_iter(self) -> <I as IntoAsyncIterator>::IntoAsyncIter
\ud83d\udd2cThis is a nightly-only experimental API. (async_iterator
#79024)Converts self
into an async iteratorSource\u00a7impl<F> IntoFuture for Fwhere\n- F: Future,
Source\u00a7type Output = <F as Future>::Output
The output that the future will produce on completion.Source\u00a7type IntoFuture = F
Which kind of future are we turning this into?Source\u00a7fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read moreSource\u00a7impl<I> IntoIterator for Iwhere\n- I: Iterator,
Source\u00a7impl<F> Pattern for F
Source\u00a7type Searcher<'a> = CharPredicateSearcher<'a, F>
\ud83d\udd2cThis is a nightly-only experimental API. (pattern
#27721)Associated searcher for this patternSource\u00a7fn into_searcher<'a>(self, haystack: &'a str) -> CharPredicateSearcher<'a, F>
\ud83d\udd2cThis is a nightly-only experimental API. (pattern
#27721)Constructs the associated searcher from\n-self
and the haystack
to search in.Source\u00a7fn is_contained_in<'a>(self, haystack: &'a str) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (pattern
#27721)Checks whether the pattern matches anywhere in the haystackSource\u00a7fn is_prefix_of<'a>(self, haystack: &'a str) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (pattern
#27721)Checks whether the pattern matches at the front of the haystackSource\u00a7fn strip_prefix_of<'a>(self, haystack: &'a str) -> Option<&'a str>
\ud83d\udd2cThis is a nightly-only experimental API. (pattern
#27721)Removes the pattern from the front of haystack, if it matches.Source\u00a7fn is_suffix_of<'a>(self, haystack: &'a str) -> boolwhere\n- CharPredicateSearcher<'a, F>: ReverseSearcher<'a>,
\ud83d\udd2cThis is a nightly-only experimental API. (pattern
#27721)Checks whether the pattern matches at the back of the haystackSource\u00a7fn strip_suffix_of<'a>(self, haystack: &'a str) -> Option<&'a str>where\n- CharPredicateSearcher<'a, F>: ReverseSearcher<'a>,
\ud83d\udd2cThis is a nightly-only experimental API. (pattern
#27721)Removes the pattern from the back of haystack, if it matches.Source\u00a7fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>>
\ud83d\udd2cThis is a nightly-only experimental API. (pattern
#27721)Returns the pattern as utf-8 bytes if possible. \n+From<T> for U
chooses to do.\n+
Source\u00a7impl<I> IntoAsyncIterator for Iwhere\n+ I: AsyncIterator,
impl<I> IntoAsyncIterator for Iwhere\n+ I: AsyncIterator,
Source\u00a7type Item = <I as AsyncIterator>::Item
type Item = <I as AsyncIterator>::Item
async_iterator
#79024)Source\u00a7type IntoAsyncIter = I
type IntoAsyncIter = I
async_iterator
#79024)Source\u00a7fn into_async_iter(self) -> <I as IntoAsyncIterator>::IntoAsyncIter
fn into_async_iter(self) -> <I as IntoAsyncIterator>::IntoAsyncIter
async_iterator
#79024)self
into an async iteratorSource\u00a7impl<F> IntoFuture for Fwhere\n+ F: Future,
impl<F> IntoFuture for Fwhere\n+ F: Future,
Source\u00a7type Output = <F as Future>::Output
type Output = <F as Future>::Output
Source\u00a7type IntoFuture = F
type IntoFuture = F
Source\u00a7fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Source\u00a7impl<I> IntoIterator for Iwhere\n+ I: Iterator,
impl<I> IntoIterator for Iwhere\n+ I: Iterator,
Source\u00a7impl<F> Pattern for F
impl<F> Pattern for F
Source\u00a7type Searcher<'a> = CharPredicateSearcher<'a, F>
type Searcher<'a> = CharPredicateSearcher<'a, F>
pattern
#27721)Source\u00a7fn into_searcher<'a>(self, haystack: &'a str) -> CharPredicateSearcher<'a, F>
fn into_searcher<'a>(self, haystack: &'a str) -> CharPredicateSearcher<'a, F>
pattern
#27721)self
and the haystack
to search in.Source\u00a7fn is_contained_in<'a>(self, haystack: &'a str) -> bool
fn is_contained_in<'a>(self, haystack: &'a str) -> bool
pattern
#27721)Source\u00a7fn is_prefix_of<'a>(self, haystack: &'a str) -> bool
fn is_prefix_of<'a>(self, haystack: &'a str) -> bool
pattern
#27721)Source\u00a7fn strip_prefix_of<'a>(self, haystack: &'a str) -> Option<&'a str>
fn strip_prefix_of<'a>(self, haystack: &'a str) -> Option<&'a str>
pattern
#27721)Source\u00a7fn is_suffix_of<'a>(self, haystack: &'a str) -> boolwhere\n+ CharPredicateSearcher<'a, F>: ReverseSearcher<'a>,
fn is_suffix_of<'a>(self, haystack: &'a str) -> boolwhere\n+ CharPredicateSearcher<'a, F>: ReverseSearcher<'a>,
pattern
#27721)Source\u00a7fn strip_suffix_of<'a>(self, haystack: &'a str) -> Option<&'a str>where\n+ CharPredicateSearcher<'a, F>: ReverseSearcher<'a>,
fn strip_suffix_of<'a>(self, haystack: &'a str) -> Option<&'a str>where\n+ CharPredicateSearcher<'a, F>: ReverseSearcher<'a>,
pattern
#27721)Source\u00a7fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>>
fn as_utf8_pattern(&self) -> Option<Utf8Pattern<'_>>
pattern
#27721)pub struct ThinBox<T: ?Sized> { /* private fields */ }
thin_box
#92791)Expand description
ThinBox.
\n+pub struct ThinBox<T: ?Sized> { /* private fields */ }
thin_box
#92791)Expand description
ThinBox.
\nA thin pointer for heap allocation, regardless of T.
\n\u00a7Examples
\n#![feature(thin_box)]\n use std::boxed::ThinBox;\n \n let five = ThinBox::new(5);\n let thin_slice = ThinBox::<[i32]>::new_unsize([1, 2, 3, 4]);\n \n use std::mem::{size_of, size_of_val};\n let size_of_ptr = size_of::<*const ()>();\n assert_eq!(size_of_ptr, size_of_val(&five));\n assert_eq!(size_of_ptr, size_of_val(&thin_slice));
Implementations\u00a7
Source\u00a7impl<T> ThinBox<T>
impl<T> ThinBox<T>
Sourcepub fn new(value: T) -> Self
\ud83d\udd2cThis is a nightly-only experimental API. (thin_box
#92791)
pub fn new(value: T) -> Self
thin_box
#92791)Moves a type to the heap with its Metadata
stored in the heap allocation instead of on\n+
Implementations\u00a7
Source\u00a7impl<T> ThinBox<T>
impl<T> ThinBox<T>
Sourcepub fn new(value: T) -> Self
\ud83d\udd2cThis is a nightly-only experimental API. (thin_box
#92791)
pub fn new(value: T) -> Self
thin_box
#92791)Sourcepub fn try_new(value: T) -> Result<Self, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (thin_box
#92791)
pub fn try_new(value: T) -> Result<Self, AllocError>
thin_box
#92791)Moves a type to the heap with its Metadata
stored in the heap allocation instead of on\n+
Sourcepub fn try_new(value: T) -> Result<Self, AllocError>
\ud83d\udd2cThis is a nightly-only experimental API. (thin_box
#92791)
pub fn try_new(value: T) -> Result<Self, AllocError>
thin_box
#92791)Source\u00a7impl<Dyn: ?Sized> ThinBox<Dyn>
impl<Dyn: ?Sized> ThinBox<Dyn>
Sourcepub fn new_unsize<T>(value: T) -> Selfwhere\n- T: Unsize<Dyn>,
\ud83d\udd2cThis is a nightly-only experimental API. (thin_box
#92791)
pub fn new_unsize<T>(value: T) -> Selfwhere\n- T: Unsize<Dyn>,
thin_box
#92791)Moves a type to the heap with its Metadata
stored in the heap allocation instead of on\n+
Trait Implementations\u00a7
Source\u00a7impl<T: ?Sized + Error> Error for ThinBox<T>
impl<T: ?Sized + Error> Error for ThinBox<T>
Source\u00a7fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 \u00b7 Source\u00a7fn description(&self) -> &str
fn description(&self) -> &str
impl<T: ?Sized + Send> Send for ThinBox<T>
ThinBox<T>
is Send
if T
is Send
because the data is owned.
impl<T: ?Sized + Sync> Sync for ThinBox<T>
ThinBox<T>
is Sync
if T
is Sync
because the data is owned.
Auto Trait Implementations\u00a7
impl<T> Freeze for ThinBox<T>where\n- T: ?Sized,
impl<T> RefUnwindSafe for ThinBox<T>where\n- T: RefUnwindSafe + ?Sized,
impl<T> Unpin for ThinBox<T>
impl<T> UnwindSafe for ThinBox<T>where\n- T: UnwindSafe + ?Sized,
Blanket Implementations\u00a7
Trait Implementations\u00a7
Source\u00a7impl<T: ?Sized + Error> Error for ThinBox<T>
impl<T: ?Sized + Error> Error for ThinBox<T>
Source\u00a7fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 \u00b7 Source\u00a7fn description(&self) -> &str
fn description(&self) -> &str
impl<T: ?Sized + Send> Send for ThinBox<T>
ThinBox<T>
is Send
if T
is Send
because the data is owned.
impl<T: ?Sized + Sync> Sync for ThinBox<T>
ThinBox<T>
is Sync
if T
is Sync
because the data is owned.
Auto Trait Implementations\u00a7
impl<T> Freeze for ThinBox<T>where\n+ T: ?Sized,
impl<T> RefUnwindSafe for ThinBox<T>where\n+ T: RefUnwindSafe + ?Sized,
impl<T> Unpin for ThinBox<T>
impl<T> UnwindSafe for ThinBox<T>where\n+ T: UnwindSafe + ?Sized,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
From<T> for U
chooses to do.\n+pub struct BinaryHeap<T, A: Allocator = Global> { /* private fields */ }
Expand description
A priority queue implemented with a binary heap.
\nThis will be a max-heap.
\nIt is a logic error for an item to be modified in such a way that the\n-item\u2019s ordering relative to any other item, as determined by the Ord
\n+item\u2019s ordering relative to any other item, as determined by the Ord
\n trait, changes while it is in the heap. This is normally only possible\n through interior mutability, global state, I/O, or unsafe code. The\n behavior resulting from such a logic error is not specified, but will\n be encapsulated to the BinaryHeap
that observed the logic error and not\n result in undefined behavior. This could include panics, incorrect results,\n aborts, memory leaks, and non-termination.
As long as no elements change their relative order while being in the heap\n@@ -56,15 +56,15 @@\n assert!(heap.is_empty())
A BinaryHeap
with a known list of items can be initialized from an array:
\u00a7Min-heap
\n-Either core::cmp::Reverse
or a custom Ord
implementation can be used to\n+
Either core::cmp::Reverse
or a custom Ord
implementation can be used to\n make BinaryHeap
a min-heap. This makes heap.pop()
return the smallest\n value instead of the greatest one.
use std::collections::BinaryHeap;\n use std::cmp::Reverse;\n \n let mut heap = BinaryHeap::new();\n@@ -81,55 +81,55 @@\n assert_eq!(heap.pop(), None);
\u00a7Time complexity
\nThe value for push
is an expected cost; the method documentation gives a\n more detailed analysis.
Implementations\u00a7
Source\u00a7impl<T: Ord> BinaryHeap<T>
impl<T: Ord> BinaryHeap<T>
1.0.0 (const: 1.80.0) \u00b7 Sourcepub const fn new() -> BinaryHeap<T>
pub const fn new() -> BinaryHeap<T>
Creates an empty BinaryHeap
as a max-heap.
Implementations\u00a7
Source\u00a7impl<T: Ord> BinaryHeap<T>
impl<T: Ord> BinaryHeap<T>
1.0.0 (const: 1.80.0) \u00b7 Sourcepub const fn new() -> BinaryHeap<T>
pub const fn new() -> BinaryHeap<T>
1.0.0 \u00b7 Sourcepub fn with_capacity(capacity: usize) -> BinaryHeap<T>
pub fn with_capacity(capacity: usize) -> BinaryHeap<T>
Creates an empty BinaryHeap
with at least the specified capacity.
1.0.0 \u00b7 Sourcepub fn with_capacity(capacity: usize) -> BinaryHeap<T>
pub fn with_capacity(capacity: usize) -> BinaryHeap<T>
Creates an empty BinaryHeap
with at least the specified capacity.
The binary heap will be able to hold at least capacity
elements without\n reallocating. This method is allowed to allocate for more elements than\n capacity
. If capacity
is zero, the binary heap will not allocate.
\u00a7Examples
\nBasic usage:
\n \n \n-Source\u00a7impl<T: Ord, A: Allocator> BinaryHeap<T, A>
impl<T: Ord, A: Allocator> BinaryHeap<T, A>
Sourcepub const fn new_in(alloc: A) -> BinaryHeap<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
pub const fn new_in(alloc: A) -> BinaryHeap<T, A>
allocator_api
#32838)Creates an empty BinaryHeap
as a max-heap, using A
as allocator.
Source\u00a7impl<T: Ord, A: Allocator> BinaryHeap<T, A>
impl<T: Ord, A: Allocator> BinaryHeap<T, A>
Sourcepub const fn new_in(alloc: A) -> BinaryHeap<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
pub const fn new_in(alloc: A) -> BinaryHeap<T, A>
allocator_api
#32838)Creates an empty BinaryHeap
as a max-heap, using A
as allocator.
\u00a7Examples
\nBasic usage:
\n \n \n-Sourcepub fn with_capacity_in(capacity: usize, alloc: A) -> BinaryHeap<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
pub fn with_capacity_in(capacity: usize, alloc: A) -> BinaryHeap<T, A>
allocator_api
#32838)Creates an empty BinaryHeap
with at least the specified capacity, using A
as allocator.
Sourcepub fn with_capacity_in(capacity: usize, alloc: A) -> BinaryHeap<T, A>
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
pub fn with_capacity_in(capacity: usize, alloc: A) -> BinaryHeap<T, A>
allocator_api
#32838)Creates an empty BinaryHeap
with at least the specified capacity, using A
as allocator.
The binary heap will be able to hold at least capacity
elements without\n reallocating. This method is allowed to allocate for more elements than\n capacity
. If capacity
is zero, the binary heap will not allocate.
\u00a7Examples
\nBasic usage:
\n \n \n-1.12.0 \u00b7 Sourcepub fn peek_mut(&mut self) -> Option<PeekMut<'_, T, A>>
pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T, A>>
Returns a mutable reference to the greatest item in the binary heap, or\n+
1.12.0 \u00b7 Sourcepub fn peek_mut(&mut self) -> Option<PeekMut<'_, T, A>>
pub fn peek_mut(&mut self) -> Option<PeekMut<'_, T, A>>
Returns a mutable reference to the greatest item in the binary heap, or\n None
if it is empty.
Note: If the PeekMut
value is leaked, some heap elements might get\n leaked along with it, but the remaining elements will remain a valid\n heap.
\u00a7Examples
\nBasic usage:
\n \n@@ -143,15 +143,15 @@\n if let Some(mut val) = heap.peek_mut() {\n *val = 0;\n }\n assert_eq!(heap.peek(), Some(&2));\u00a7Time complexity
\nIf the item is modified then the worst case time complexity is O(log(n)),\n otherwise it\u2019s O(1).
\n-1.0.0 \u00b7 Sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Removes the greatest item from the binary heap and returns it, or None
if it\n+
1.0.0 \u00b7 Sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Removes the greatest item from the binary heap and returns it, or None
if it\n is empty.
\u00a7Examples
\nBasic usage:
\n \n \n1.70.0 \u00b7 Sourcepub fn retain<F>(&mut self, f: F)
pub fn retain<F>(&mut self, f: F)
Retains only the elements specified by the predicate.
\nIn other words, remove all elements e
for which f(&e)
returns\n false
. The elements are visited in unsorted (and unspecified) order.
\u00a7Examples
\nBasic usage:
\n \nuse std::collections::BinaryHeap;\n \n@@ -263,72 +263,72 @@\n Basic usage:
\n \n \n-
1.0.0 \u00b7 Sourcepub fn peek(&self) -> Option<&T>
pub fn peek(&self) -> Option<&T>
Returns the greatest item in the binary heap, or None
if it is empty.
1.0.0 \u00b7 Sourcepub fn peek(&self) -> Option<&T>
pub fn peek(&self) -> Option<&T>
Returns the greatest item in the binary heap, or None
if it is empty.
\u00a7Examples
\nBasic usage:
\n \nuse std::collections::BinaryHeap;\n let mut heap = BinaryHeap::new();\n assert_eq!(heap.peek(), None);\n \n heap.push(1);\n heap.push(5);\n heap.push(2);\n assert_eq!(heap.peek(), Some(&5));\n
\u00a7Time complexity
\nCost is O(1) in the worst case.
\n-1.0.0 \u00b7 Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the binary heap can hold without reallocating.
\n+1.0.0 \u00b7 Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
Returns the number of elements the binary heap can hold without reallocating.
\n\u00a7Examples
\nBasic usage:
\n \n \n-1.0.0 \u00b7 Sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for at least additional
elements more than\n+
1.0.0 \u00b7 Sourcepub fn reserve_exact(&mut self, additional: usize)
pub fn reserve_exact(&mut self, additional: usize)
Reserves the minimum capacity for at least additional
elements more than\n the current length. Unlike reserve
, this will not\n deliberately over-allocate to speculatively avoid frequent allocations.\n After calling reserve_exact
, capacity will be greater than or equal to\n self.len() + additional
. Does nothing if the capacity is already\n sufficient.
\u00a7Panics
\n-Panics if the new capacity overflows usize
.
Panics if the new capacity overflows usize
.
\u00a7Examples
\nBasic usage:
\n \n \n-1.0.0 \u00b7 Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
elements more than the\n+
1.0.0 \u00b7 Sourcepub fn reserve(&mut self, additional: usize)
pub fn reserve(&mut self, additional: usize)
Reserves capacity for at least additional
elements more than the\n current length. The allocator may reserve more space to speculatively\n avoid frequent allocations. After calling reserve
,\n capacity will be greater than or equal to self.len() + additional
.\n Does nothing if capacity is already sufficient.
\u00a7Panics
\n-Panics if the new capacity overflows usize
.
Panics if the new capacity overflows usize
.
\u00a7Examples
\nBasic usage:
\n \n \n1.63.0 \u00b7 Sourcepub fn try_reserve_exact(\n &mut self,\n- additional: usize,\n-) -> Result<(), TryReserveError>
pub fn try_reserve_exact(\n &mut self,\n- additional: usize,\n-) -> Result<(), TryReserveError>
Tries to reserve the minimum capacity for at least additional
elements\n+ additional: usize,\n+) -> Result<(), TryReserveError>
Tries to reserve the minimum capacity for at least additional
elements\n more than the current length. Unlike try_reserve
, this will not\n deliberately over-allocate to speculatively avoid frequent allocations.\n After calling try_reserve_exact
, capacity will be greater than or\n equal to self.len() + additional
if it returns Ok(())
.\n Does nothing if the capacity is already sufficient.
Note that the allocator may give the collection more space than it\n requests. Therefore, capacity can not be relied upon to be precisely\n@@ -347,15 +347,15 @@\n heap.try_reserve_exact(data.len())?;\n \n // Now we know this can't OOM in the middle of our complex work\n heap.extend(data.iter());\n \n Ok(heap.pop())\n }
1.63.0 \u00b7 Sourcepub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve capacity for at least additional
elements more than the\n+
1.63.0 \u00b7 Sourcepub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>
Tries to reserve capacity for at least additional
elements more than the\n current length. The allocator may reserve more space to speculatively\n avoid frequent allocations. After calling try_reserve
, capacity will be\n greater than or equal to self.len() + additional
if it returns\n Ok(())
. Does nothing if capacity is already sufficient. This method\n preserves the contents even if an error occurs.
\u00a7Errors
\nIf the capacity overflows, or the allocator reports a failure, then an error\n@@ -381,26 +381,26 @@\n \n
\n-1.56.0 \u00b7 Sourcepub fn shrink_to(&mut self, min_capacity: usize)
pub fn shrink_to(&mut self, min_capacity: usize)
Discards capacity with a lower bound.
\n+1.56.0 \u00b7 Sourcepub fn shrink_to(&mut self, min_capacity: usize)
pub fn shrink_to(&mut self, min_capacity: usize)
Discards capacity with a lower bound.
\nThe capacity will remain at least as large as both the length\n and the supplied value.
\nIf the current capacity is less than the lower limit, this is a no-op.
\n\u00a7Examples
\n \n-1.80.0 \u00b7 Sourcepub fn as_slice(&self) -> &[T]
pub fn as_slice(&self) -> &[T]
Returns a slice of all values in the underlying vector, in arbitrary\n+
1.80.0 \u00b7 Sourcepub fn as_slice(&self) -> &[T]
pub fn as_slice(&self) -> &[T]
Returns a slice of all values in the underlying vector, in arbitrary\n order.
\n\u00a7Examples
\nBasic usage:
\n \n \n-Sourcepub fn allocator(&self) -> &A
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
pub fn allocator(&self) -> &A
allocator_api
#32838)Returns a reference to the underlying allocator.
\n-Sourcepub fn allocator(&self) -> &A
\ud83d\udd2cThis is a nightly-only experimental API. (allocator_api
#32838)
pub fn allocator(&self) -> &A
allocator_api
#32838)Returns a reference to the underlying allocator.
\n+1.0.0 \u00b7 Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Trait Implementations\u00a7
1.0.0 \u00b7 Source\u00a7impl<T: Clone, A: Allocator + Clone> Clone for BinaryHeap<T, A>
impl<T: Clone, A: Allocator + Clone> Clone for BinaryHeap<T, A>
Source\u00a7fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Overwrites the contents of self
with a clone of the contents of source
.
Trait Implementations\u00a7
1.0.0 \u00b7 Source\u00a7impl<T: Clone, A: Allocator + Clone> Clone for BinaryHeap<T, A>
impl<T: Clone, A: Allocator + Clone> Clone for BinaryHeap<T, A>
Source\u00a7fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Overwrites the contents of self
with a clone of the contents of source
.
This method is preferred over simply assigning source.clone()
to self
,\n as it avoids reallocation if possible.
See Vec::clone_from()
for more details.
1.0.0 \u00b7 Source\u00a7impl<T: Ord> Default for BinaryHeap<T>
impl<T: Ord> Default for BinaryHeap<T>
Source\u00a7fn default() -> BinaryHeap<T>
fn default() -> BinaryHeap<T>
Creates an empty BinaryHeap<T>
.
1.2.0 \u00b7 Source\u00a7impl<'a, T: 'a + Ord + Copy, A: Allocator> Extend<&'a T> for BinaryHeap<T, A>
impl<'a, T: 'a + Ord + Copy, A: Allocator> Extend<&'a T> for BinaryHeap<T, A>
Source\u00a7fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
Source\u00a7fn extend_one(&mut self, item: &'a T)
fn extend_one(&mut self, item: &'a T)
extend_one
#72631)1.0.0 \u00b7 Source\u00a7impl<T: Ord, A: Allocator> Extend<T> for BinaryHeap<T, A>
impl<T: Ord, A: Allocator> Extend<T> for BinaryHeap<T, A>
Source\u00a7fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Source\u00a7fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one
#72631)1.0.0 \u00b7 Source\u00a7impl<T: Ord> Default for BinaryHeap<T>
impl<T: Ord> Default for BinaryHeap<T>
Source\u00a7fn default() -> BinaryHeap<T>
fn default() -> BinaryHeap<T>
Creates an empty BinaryHeap<T>
.
1.2.0 \u00b7 Source\u00a7impl<'a, T: 'a + Ord + Copy, A: Allocator> Extend<&'a T> for BinaryHeap<T, A>
impl<'a, T: 'a + Ord + Copy, A: Allocator> Extend<&'a T> for BinaryHeap<T, A>
Source\u00a7fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = &'a T>>(&mut self, iter: I)
Source\u00a7fn extend_one(&mut self, item: &'a T)
fn extend_one(&mut self, item: &'a T)
extend_one
#72631)1.0.0 \u00b7 Source\u00a7impl<T: Ord, A: Allocator> Extend<T> for BinaryHeap<T, A>
impl<T: Ord, A: Allocator> Extend<T> for BinaryHeap<T, A>
Source\u00a7fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)
Source\u00a7fn extend_one(&mut self, item: T)
fn extend_one(&mut self, item: T)
extend_one
#72631)1.5.0 \u00b7 Source\u00a7impl<T, A: Allocator> From<BinaryHeap<T, A>> for Vec<T, A>
impl<T, A: Allocator> From<BinaryHeap<T, A>> for Vec<T, A>
Source\u00a7fn from(heap: BinaryHeap<T, A>) -> Vec<T, A>
fn from(heap: BinaryHeap<T, A>) -> Vec<T, A>
Converts a BinaryHeap<T>
into a Vec<T>
.
1.5.0 \u00b7 Source\u00a7impl<T, A: Allocator> From<BinaryHeap<T, A>> for Vec<T, A>
impl<T, A: Allocator> From<BinaryHeap<T, A>> for Vec<T, A>
Source\u00a7fn from(heap: BinaryHeap<T, A>) -> Vec<T, A>
fn from(heap: BinaryHeap<T, A>) -> Vec<T, A>
Converts a BinaryHeap<T>
into a Vec<T>
.
This conversion requires no data movement or allocation, and has\n constant time complexity.
\n-1.5.0 \u00b7 Source\u00a7impl<T: Ord, A: Allocator> From<Vec<T, A>> for BinaryHeap<T, A>
impl<T: Ord, A: Allocator> From<Vec<T, A>> for BinaryHeap<T, A>
Source\u00a7fn from(vec: Vec<T, A>) -> BinaryHeap<T, A>
fn from(vec: Vec<T, A>) -> BinaryHeap<T, A>
Converts a Vec<T>
into a BinaryHeap<T>
.
1.5.0 \u00b7 Source\u00a7impl<T: Ord, A: Allocator> From<Vec<T, A>> for BinaryHeap<T, A>
impl<T: Ord, A: Allocator> From<Vec<T, A>> for BinaryHeap<T, A>
Source\u00a7fn from(vec: Vec<T, A>) -> BinaryHeap<T, A>
fn from(vec: Vec<T, A>) -> BinaryHeap<T, A>
Converts a Vec<T>
into a BinaryHeap<T>
.
This conversion happens in-place, and has O(n) time complexity.
\n-1.0.0 \u00b7 Source\u00a7impl<T: Ord> FromIterator<T> for BinaryHeap<T>
impl<T: Ord> FromIterator<T> for BinaryHeap<T>
Source\u00a7fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> BinaryHeap<T>
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> BinaryHeap<T>
1.0.0 \u00b7 Source\u00a7impl<'a, T, A: Allocator> IntoIterator for &'a BinaryHeap<T, A>
impl<'a, T, A: Allocator> IntoIterator for &'a BinaryHeap<T, A>
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> IntoIterator for BinaryHeap<T, A>
impl<T, A: Allocator> IntoIterator for BinaryHeap<T, A>
1.0.0 \u00b7 Source\u00a7impl<T: Ord> FromIterator<T> for BinaryHeap<T>
impl<T: Ord> FromIterator<T> for BinaryHeap<T>
Source\u00a7fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> BinaryHeap<T>
fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> BinaryHeap<T>
1.0.0 \u00b7 Source\u00a7impl<'a, T, A: Allocator> IntoIterator for &'a BinaryHeap<T, A>
impl<'a, T, A: Allocator> IntoIterator for &'a BinaryHeap<T, A>
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> IntoIterator for BinaryHeap<T, A>
impl<T, A: Allocator> IntoIterator for BinaryHeap<T, A>
Auto Trait Implementations\u00a7
impl<T, A> Freeze for BinaryHeap<T, A>where\n- A: Freeze,
impl<T, A> RefUnwindSafe for BinaryHeap<T, A>where\n- A: RefUnwindSafe,\n- T: RefUnwindSafe,
impl<T, A> Send for BinaryHeap<T, A>
impl<T, A> Sync for BinaryHeap<T, A>
impl<T, A> Unpin for BinaryHeap<T, A>
impl<T, A> UnwindSafe for BinaryHeap<T, A>where\n- A: UnwindSafe,\n- T: UnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
impl<T> CloneToUninit for Twhere\n- T: Clone,
Auto Trait Implementations\u00a7
impl<T, A> Freeze for BinaryHeap<T, A>where\n+ A: Freeze,
impl<T, A> RefUnwindSafe for BinaryHeap<T, A>where\n+ A: RefUnwindSafe,\n+ T: RefUnwindSafe,
impl<T, A> Send for BinaryHeap<T, A>
impl<T, A> Sync for BinaryHeap<T, A>
impl<T, A> Unpin for BinaryHeap<T, A>
impl<T, A> UnwindSafe for BinaryHeap<T, A>where\n+ A: UnwindSafe,\n+ T: UnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7fn to_owned(&self) -> T
fn to_owned(&self) -> T
Source\u00a7fn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
pub struct Drain<'a, T: 'a, A: Allocator = Global> { /* private fields */ }
Expand description
A draining iterator over the elements of a BinaryHeap
.
This struct
is created by BinaryHeap::drain()
. See its\n documentation for more.
Implementations\u00a7
Trait Implementations\u00a7
1.6.0 \u00b7 Source\u00a7impl<T, A: Allocator> DoubleEndedIterator for Drain<'_, T, A>
impl<T, A: Allocator> DoubleEndedIterator for Drain<'_, T, A>
Source\u00a7fn next_back(&mut self) -> Option<T>
fn next_back(&mut self) -> Option<T>
Source\u00a7fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.37.0 \u00b7 Source\u00a7fn 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 more1.27.0 \u00b7 Source\u00a7fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
Iterator::try_fold()
: it takes\n-elements starting from the back of the iterator. Read more1.6.0 \u00b7 Source\u00a7impl<T, A: Allocator> ExactSizeIterator for Drain<'_, T, A>
impl<T, A: Allocator> ExactSizeIterator for Drain<'_, T, A>
1.6.0 \u00b7 Source\u00a7impl<T, A: Allocator> Iterator for Drain<'_, T, A>
impl<T, A: Allocator> Iterator for Drain<'_, T, A>
Implementations\u00a7
Trait Implementations\u00a7
1.6.0 \u00b7 Source\u00a7impl<T, A: Allocator> DoubleEndedIterator for Drain<'_, T, A>
impl<T, A: Allocator> DoubleEndedIterator for Drain<'_, T, A>
Source\u00a7fn next_back(&mut self) -> Option<T>
fn next_back(&mut self) -> Option<T>
Source\u00a7fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.37.0 \u00b7 Source\u00a7fn 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 more1.27.0 \u00b7 Source\u00a7fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
Iterator::try_fold()
: it takes\n+elements starting from the back of the iterator. Read more1.6.0 \u00b7 Source\u00a7impl<T, A: Allocator> ExactSizeIterator for Drain<'_, T, A>
impl<T, A: Allocator> ExactSizeIterator for Drain<'_, T, A>
1.6.0 \u00b7 Source\u00a7impl<T, A: Allocator> Iterator for Drain<'_, T, A>
impl<T, A: Allocator> Iterator for Drain<'_, T, A>
Source\u00a7fn next(&mut self) -> Option<T>
fn next(&mut self) -> Option<T>
Source\u00a7fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Source\u00a7fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n- Self: Sized,
fn count(self) -> usizewhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n- Self: Sized,
fn last(self) -> Option<Self::Item>where\n- Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n-items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n-between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
peek
and peek_mut
methods\n+) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n+ Self: Sized,
fn count(self) -> usizewhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n+items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n+between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
n
elements, or fewer\n-if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n-self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n-the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n+their documentation for more information. Read more
fn try_collect<B>(\n+their documentation for more information. Read more
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
n
elements, or fewer\n+if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n+self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n+the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usizewhere\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryTypewhere\n+ Self: Sized,\n+ Self::Item: Try,\n+ <Self::Item as Try>::Residual: Residual<B>,\n+ B: FromIterator<<Self::Item as Try>::Output>,\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n+ Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n+ P: FnMut(&T) -> bool,\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n such that all those that return true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
fn partition_in_place<'a, T, P>(self, predicate: P) -> usizewhere\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryTypewhere\n+ Self: Sized,\n+ Self::Item: Try,\n+ <Self::Item as Try>::Residual: Residual<B>,\n+ B: FromIterator<<Self::Item as Try>::Output>,\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n+ Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n+ P: FnMut(&T) -> bool,\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n such that all those that return true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
iter_partition_in_place
#62543)iter_partition_in_place
#62543)true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
Source\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn rposition<P>(&mut self, predicate: P) -> Option<usize>
fn rposition<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn rev(self) -> Rev<Self>where\n- Self: Sized + DoubleEndedIterator,
fn rev(self) -> Rev<Self>where\n- Self: Sized + DoubleEndedIterator,
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n-this Iterator
with those of another. The comparison works like short-circuit\n+ f: impl FnMut(&Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypetry_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn rposition<P>(&mut self, predicate: P) -> Option<usize>
fn rposition<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn rev(self) -> Rev<Self>where\n+ Self: Sized + DoubleEndedIterator,
fn rev(self) -> Rev<Self>where\n+ Self: Sized + DoubleEndedIterator,
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n+this Iterator
with those of another. The comparison works like short-circuit\n evaluation, returning a result without comparing the remaining elements.\n-As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n- Self: Sized,\n- I: IntoIterator,\n- 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\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T, A: Allocator> FusedIterator for Drain<'_, T, A>
Auto Trait Implementations\u00a7
impl<'a, T, A> Freeze for Drain<'a, T, A>
impl<'a, T, A> RefUnwindSafe for Drain<'a, T, A>where\n- T: RefUnwindSafe,\n- A: RefUnwindSafe,
impl<'a, T, A> Send for Drain<'a, T, A>
impl<'a, T, A> Sync for Drain<'a, T, A>
impl<'a, T, A> Unpin for Drain<'a, T, A>
impl<'a, T, A> UnwindSafe for Drain<'a, T, A>where\n- T: RefUnwindSafe,\n- A: RefUnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
impl<T, U> Into<U> for Twhere\n- U: From<T>,
Source\u00a7fn into(self) -> U
fn into(self) -> U
Calls U::from(self)
.
Source\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n+ Self: Sized,\n+ I: IntoIterator,\n+ 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\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T, A: Allocator> FusedIterator for Drain<'_, T, A>
Auto Trait Implementations\u00a7
impl<'a, T, A> Freeze for Drain<'a, T, A>
impl<'a, T, A> RefUnwindSafe for Drain<'a, T, A>where\n+ T: RefUnwindSafe,\n+ A: RefUnwindSafe,
impl<'a, T, A> Send for Drain<'a, T, A>
impl<'a, T, A> Sync for Drain<'a, T, A>
impl<'a, T, A> Unpin for Drain<'a, T, A>
impl<'a, T, A> UnwindSafe for Drain<'a, T, A>where\n+ T: RefUnwindSafe,\n+ A: RefUnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<I> IntoIterator for Iwhere\n- I: Iterator,
impl<I> IntoIterator for Iwhere\n- I: Iterator,
From<T> for U
chooses to do.\n+Source\u00a7impl<I> IntoIterator for Iwhere\n+ I: Iterator,
impl<I> IntoIterator for Iwhere\n+ I: Iterator,
pub struct DrainSorted<'a, T: Ord, A: Allocator = Global> { /* private fields */ }
binary_heap_drain_sorted
#59278)Expand description
A draining iterator over the elements of a BinaryHeap
.
pub struct DrainSorted<'a, T: Ord, A: Allocator = Global> { /* private fields */ }
binary_heap_drain_sorted
#59278)Expand description
A draining iterator over the elements of a BinaryHeap
.
This struct
is created by BinaryHeap::drain_sorted()
. See its\n documentation for more.
Implementations\u00a7
Trait Implementations\u00a7
Source\u00a7impl<T: Ord, A: Allocator> ExactSizeIterator for DrainSorted<'_, T, A>
impl<T: Ord, A: Allocator> ExactSizeIterator for DrainSorted<'_, T, A>
Source\u00a7impl<T: Ord, A: Allocator> Iterator for DrainSorted<'_, T, A>
impl<T: Ord, A: Allocator> Iterator for DrainSorted<'_, T, A>
Implementations\u00a7
Trait Implementations\u00a7
Source\u00a7impl<T: Ord, A: Allocator> ExactSizeIterator for DrainSorted<'_, T, A>
impl<T: Ord, A: Allocator> ExactSizeIterator for DrainSorted<'_, T, A>
Source\u00a7impl<T: Ord, A: Allocator> Iterator for DrainSorted<'_, T, A>
impl<T: Ord, A: Allocator> Iterator for DrainSorted<'_, T, A>
Source\u00a7fn next(&mut self) -> Option<T>
fn next(&mut self) -> Option<T>
Source\u00a7fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Source\u00a7fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n- Self: Sized,
fn count(self) -> usizewhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n- Self: Sized,
fn last(self) -> Option<Self::Item>where\n- Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n-items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n-between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
peek
and peek_mut
methods\n+) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n+ Self: Sized,
fn count(self) -> usizewhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n+items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n+between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
n
elements, or fewer\n-if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n-self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n-the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n+their documentation for more information. Read more
fn try_collect<B>(\n+their documentation for more information. Read more
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
n
elements, or fewer\n+if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n+self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n+the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_reduce<R>(\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n-this Iterator
with those of another. The comparison works like short-circuit\n+ f: impl FnMut(&Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypetry_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n+this Iterator
with those of another. The comparison works like short-circuit\n evaluation, returning a result without comparing the remaining elements.\n-As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n- Self: Sized,\n- I: IntoIterator,\n- 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\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T: Ord, A: Allocator> FusedIterator for DrainSorted<'_, T, A>
impl<T: Ord, A: Allocator> TrustedLen for DrainSorted<'_, T, A>
Auto Trait Implementations\u00a7
impl<'a, T, A> Freeze for DrainSorted<'a, T, A>
impl<'a, T, A> RefUnwindSafe for DrainSorted<'a, T, A>where\n- A: RefUnwindSafe,\n- T: RefUnwindSafe,
impl<'a, T, A> Send for DrainSorted<'a, T, A>
impl<'a, T, A> Sync for DrainSorted<'a, T, A>
impl<'a, T, A> Unpin for DrainSorted<'a, T, A>
impl<'a, T, A = Global> !UnwindSafe for DrainSorted<'a, T, A>
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
impl<T, U> Into<U> for Twhere\n- U: From<T>,
Source\u00a7fn into(self) -> U
fn into(self) -> U
Calls U::from(self)
.
Source\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n+ Self: Sized,\n+ I: IntoIterator,\n+ 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\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T: Ord, A: Allocator> FusedIterator for DrainSorted<'_, T, A>
impl<T: Ord, A: Allocator> TrustedLen for DrainSorted<'_, T, A>
Auto Trait Implementations\u00a7
impl<'a, T, A> Freeze for DrainSorted<'a, T, A>
impl<'a, T, A> RefUnwindSafe for DrainSorted<'a, T, A>where\n+ A: RefUnwindSafe,\n+ T: RefUnwindSafe,
impl<'a, T, A> Send for DrainSorted<'a, T, A>
impl<'a, T, A> Sync for DrainSorted<'a, T, A>
impl<'a, T, A> Unpin for DrainSorted<'a, T, A>
impl<'a, T, A = Global> !UnwindSafe for DrainSorted<'a, T, A>
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<I> IntoIterator for Iwhere\n- I: Iterator,
impl<I> IntoIterator for Iwhere\n- I: Iterator,
From<T> for U
chooses to do.\n+Source\u00a7impl<I> IntoIterator for Iwhere\n+ I: Iterator,
impl<I> IntoIterator for Iwhere\n+ I: Iterator,
pub struct IntoIter<T, A: Allocator = Global> { /* private fields */ }
Expand description
An owning iterator over the elements of a BinaryHeap
.
This struct
is created by BinaryHeap::into_iter()
\n-(provided by the IntoIterator
trait). See its documentation for more.
Implementations\u00a7
Trait Implementations\u00a7
1.70.0 \u00b7 Source\u00a7impl<T> Default for IntoIter<T>
impl<T> Default for IntoIter<T>
Source\u00a7fn default() -> Self
fn default() -> Self
Creates an empty binary_heap::IntoIter
.
IntoIterator
trait). See its documentation for more.\n+Implementations\u00a7
Trait Implementations\u00a7
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A>
impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A>
Source\u00a7fn next_back(&mut self) -> Option<T>
fn next_back(&mut self) -> Option<T>
Source\u00a7fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.37.0 \u00b7 Source\u00a7fn 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 more1.27.0 \u00b7 Source\u00a7fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
Iterator::try_fold()
: it takes\n-elements starting from the back of the iterator. Read more1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A>
impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A>
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> Iterator for IntoIter<T, A>
impl<T, A: Allocator> Iterator for IntoIter<T, A>
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A>
impl<T, A: Allocator> DoubleEndedIterator for IntoIter<T, A>
Source\u00a7fn next_back(&mut self) -> Option<T>
fn next_back(&mut self) -> Option<T>
Source\u00a7fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.37.0 \u00b7 Source\u00a7fn 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 more1.27.0 \u00b7 Source\u00a7fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
Iterator::try_fold()
: it takes\n+elements starting from the back of the iterator. Read more1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A>
impl<T, A: Allocator> ExactSizeIterator for IntoIter<T, A>
1.0.0 \u00b7 Source\u00a7impl<T, A: Allocator> Iterator for IntoIter<T, A>
impl<T, A: Allocator> Iterator for IntoIter<T, A>
Source\u00a7fn next(&mut self) -> Option<T>
fn next(&mut self) -> Option<T>
Source\u00a7fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Source\u00a7fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n- Self: Sized,
fn count(self) -> usizewhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n- Self: Sized,
fn last(self) -> Option<Self::Item>where\n- Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n-items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n-between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
peek
and peek_mut
methods\n+) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n+ Self: Sized,
fn count(self) -> usizewhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n+items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n+between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
n
elements, or fewer\n-if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n-self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n-the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n+their documentation for more information. Read more
fn try_collect<B>(\n+their documentation for more information. Read more
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
n
elements, or fewer\n+if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n+self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n+the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usizewhere\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryTypewhere\n+ Self: Sized,\n+ Self::Item: Try,\n+ <Self::Item as Try>::Residual: Residual<B>,\n+ B: FromIterator<<Self::Item as Try>::Output>,\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n+ Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n+ P: FnMut(&T) -> bool,\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n such that all those that return true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
fn partition_in_place<'a, T, P>(self, predicate: P) -> usizewhere\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryTypewhere\n+ Self: Sized,\n+ Self::Item: Try,\n+ <Self::Item as Try>::Residual: Residual<B>,\n+ B: FromIterator<<Self::Item as Try>::Output>,\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n+ Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n+ P: FnMut(&T) -> bool,\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n such that all those that return true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
iter_partition_in_place
#62543)iter_partition_in_place
#62543)true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
Source\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn rposition<P>(&mut self, predicate: P) -> Option<usize>
fn rposition<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn rev(self) -> Rev<Self>where\n- Self: Sized + DoubleEndedIterator,
fn rev(self) -> Rev<Self>where\n- Self: Sized + DoubleEndedIterator,
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n-this Iterator
with those of another. The comparison works like short-circuit\n+ f: impl FnMut(&Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypetry_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn rposition<P>(&mut self, predicate: P) -> Option<usize>
fn rposition<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn rev(self) -> Rev<Self>where\n+ Self: Sized + DoubleEndedIterator,
fn rev(self) -> Rev<Self>where\n+ Self: Sized + DoubleEndedIterator,
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n+this Iterator
with those of another. The comparison works like short-circuit\n evaluation, returning a result without comparing the remaining elements.\n-As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n- Self: Sized,\n- I: IntoIterator,\n- 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\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T, A: Allocator> FusedIterator for IntoIter<T, A>
Auto Trait Implementations\u00a7
impl<T, A> Freeze for IntoIter<T, A>where\n- A: Freeze,
impl<T, A> RefUnwindSafe for IntoIter<T, A>where\n- T: RefUnwindSafe,\n- A: RefUnwindSafe,
impl<T, A> Send for IntoIter<T, A>
impl<T, A> Sync for IntoIter<T, A>
impl<T, A> Unpin for IntoIter<T, A>
impl<T, A> UnwindSafe for IntoIter<T, A>
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
impl<T, U> Into<U> for Twhere\n- U: From<T>,
Source\u00a7fn into(self) -> U
fn into(self) -> U
Calls U::from(self)
.
Source\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n+ Self: Sized,\n+ I: IntoIterator,\n+ 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\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T, A: Allocator> FusedIterator for IntoIter<T, A>
Auto Trait Implementations\u00a7
impl<T, A> Freeze for IntoIter<T, A>where\n+ A: Freeze,
impl<T, A> RefUnwindSafe for IntoIter<T, A>where\n+ T: RefUnwindSafe,\n+ A: RefUnwindSafe,
impl<T, A> Send for IntoIter<T, A>
impl<T, A> Sync for IntoIter<T, A>
impl<T, A> Unpin for IntoIter<T, A>
impl<T, A> UnwindSafe for IntoIter<T, A>
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7impl<I> IntoIterator for Iwhere\n- I: Iterator,
impl<I> IntoIterator for Iwhere\n- I: Iterator,
From<T> for U
chooses to do.\n+Source\u00a7impl<I> IntoIterator for Iwhere\n+ I: Iterator,
impl<I> IntoIterator for Iwhere\n+ I: Iterator,
pub struct IntoIterSorted<T, A: Allocator = Global> { /* private fields */ }
binary_heap_into_iter_sorted
#59278)Implementations\u00a7
Trait Implementations\u00a7
Source\u00a7impl<T: Clone, A: Clone + Allocator> Clone for IntoIterSorted<T, A>
impl<T: Clone, A: Clone + Allocator> Clone for IntoIterSorted<T, A>
1.0.0 \u00b7 Source\u00a7fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource\u00a7impl<T: Ord, A: Allocator> ExactSizeIterator for IntoIterSorted<T, A>
impl<T: Ord, A: Allocator> ExactSizeIterator for IntoIterSorted<T, A>
Source\u00a7impl<T: Ord, A: Allocator> Iterator for IntoIterSorted<T, A>
impl<T: Ord, A: Allocator> Iterator for IntoIterSorted<T, A>
Source\u00a7fn next(&mut self) -> Option<T>
fn next(&mut self) -> Option<T>
Source\u00a7fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Source\u00a7fn next_chunk<const N: usize>(\n+IntoIterSorted in alloc::collections::binary_heap - Rust pub struct IntoIterSorted<T, A: Allocator = Global> { /* private fields */ }
\ud83d\udd2cThis is a nightly-only experimental API. (binary_heap_into_iter_sorted
#59278)Implementations\u00a7
Trait Implementations\u00a7
Source\u00a7impl<T: Clone, A: Clone + Allocator> Clone for IntoIterSorted<T, A>
1.0.0 \u00b7 Source\u00a7fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read moreSource\u00a7impl<T: Ord, A: Allocator> ExactSizeIterator for IntoIterSorted<T, A>
Source\u00a7impl<T: Ord, A: Allocator> Iterator for IntoIterSorted<T, A>
Source\u00a7fn next(&mut self) -> Option<T>
Advances the iterator and returns the next value. Read moreSource\u00a7fn size_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. Read moreSource\u00a7fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_next_chunk
#98326)Advances the iterator and returns an array containing the next N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n- Self: Sized,
Consumes the iterator, counting the number of iterations and returning it. Read more1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n- Self: Sized,
Consumes the iterator, returning the last element. Read moreSource\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_advance_by
#77404)Advances the iterator by n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
Creates an iterator starting at the same point, but stepping by\n-the given amount at each iteration. Read more1.0.0 \u00b7 Source\u00a7fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
Takes two iterators and creates a new iterator over both in sequence. Read more1.0.0 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
\u2018Zips up\u2019 two iterators into a single iterator of pairs. Read moreSource\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places a copy of separator
between adjacent\n-items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places an item generated by separator
\n-between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
Takes a closure and creates an iterator which calls that closure on each\n-element. Read more1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
Calls a closure on each element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
Creates an iterator which uses a closure to determine if an element\n-should be yielded. Read more1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
Creates an iterator that both filters and maps. Read more1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
Creates an iterator which gives the current iteration count as well as\n-the next value. Read more1.0.0 \u00b7 Source\u00a7fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
Creates an iterator which can use the peek
and peek_mut
methods\n+) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n+ Self: Sized,\ud83d\udd2cThis is a nightly-only experimental API. (iter_next_chunk
#98326)Advances the iterator and returns an array containing the next N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n+ Self: Sized,
Consumes the iterator, counting the number of iterations and returning it. Read more1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
Consumes the iterator, returning the last element. Read moreSource\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_advance_by
#77404)Advances the iterator by n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
Creates an iterator starting at the same point, but stepping by\n+the given amount at each iteration. Read more1.0.0 \u00b7 Source\u00a7fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
Takes two iterators and creates a new iterator over both in sequence. Read more1.0.0 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
\u2018Zips up\u2019 two iterators into a single iterator of pairs. Read moreSource\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places a copy of separator
between adjacent\n+items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places an item generated by separator
\n+between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
Takes a closure and creates an iterator which calls that closure on each\n+element. Read more1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
Calls a closure on each element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
Creates an iterator which uses a closure to determine if an element\n+should be yielded. Read more1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
Creates an iterator that both filters and maps. Read more1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
Creates an iterator which gives the current iteration count as well as\n+the next value. Read more1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Creates an iterator that yields elements based on a predicate. Read more1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
Creates an iterator that both yields elements based on a predicate and maps. Read more1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
Creates an iterator that skips the first n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
Creates an iterator that yields the first n
elements, or fewer\n-if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Creates an iterator that works like map, but flattens nested structure. Read more1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
Creates an iterator that flattens nested structure. Read moreSource\u00a7fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_map_windows
#87155)Calls the given function f
for each contiguous window of size N
over\n-self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n-the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
Does something with each element of an iterator, passing the value on. Read more1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
Borrows an iterator, rather than consuming it. Read more1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
Transforms an iterator into a collection. Read moreSource\u00a7fn try_collect<B>(\n+their documentation for more information. Read more
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Creates an iterator that yields elements based on a predicate. Read more1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
Creates an iterator that both yields elements based on a predicate and maps. Read more1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
Creates an iterator that skips the first n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
Creates an iterator that yields the first n
elements, or fewer\n+if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Creates an iterator that works like map, but flattens nested structure. Read more1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
Creates an iterator that flattens nested structure. Read moreSource\u00a7fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_map_windows
#87155)Calls the given function f
for each contiguous window of size N
over\n+self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n+the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
Does something with each element of an iterator, passing the value on. Read more1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
Borrows an iterator, rather than consuming it. Read more1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
Transforms an iterator into a collection. Read moreSource\u00a7fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n-a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n+such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n+successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n+iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n+returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n+operation. Read moreSource\u00a7fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_reduce
#87053)Reduces the elements to a single one by repeatedly applying a reducing operation. If the\n-closure returns a failure, the failure is propagated back to the caller immediately. Read more1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
Tests if every element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
Tests if any element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
Searches for an element of an iterator that satisfies a predicate. Read more1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
Applies function to the elements of iterator and returns\n-the first non-none result. Read moreSource\u00a7fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_reduce
#87053)Reduces the elements to a single one by repeatedly applying a reducing operation. If the\n+closure returns a failure, the failure is propagated back to the caller immediately. Read more1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
Tests if every element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
Tests if any element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
Searches for an element of an iterator that satisfies a predicate. Read more1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
Applies function to the elements of iterator and returns\n+the first non-none result. Read moreSource\u00a7fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (try_find
#63178)Applies function to the elements of iterator and returns\n-the first true result or the first error. Read more1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
Searches for an element in an iterator, returning its index. Read more1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
Returns the maximum element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
Returns the minimum element of an iterator. Read more1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the maximum value from the\n-specified function. Read more1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the maximum value with respect to the\n-specified comparison function. Read more1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the minimum value from the\n-specified function. Read more1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the minimum value with respect to the\n-specified comparison function. Read more1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
Converts an iterator of pairs into a pair of containers. Read more1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
Creates an iterator which copies all of its elements. Read moreSource\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_array_chunks
#100450)Returns an iterator over N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
Iterates over the entire iterator, multiplying all the elements Read moreSource\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n-of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
Lexicographically compares the PartialOrd
elements of\n-this Iterator
with those of another. The comparison works like short-circuit\n+ f: impl FnMut(&Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere\n+ Self: Sized,\n+ R: Try<Output = bool>,\n+ <R as Try>::Residual: Residual<Option<Self::Item>>,\ud83d\udd2cThis is a nightly-only experimental API. (try_find
#63178)Applies function to the elements of iterator and returns\n+the first true result or the first error. Read more1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
Searches for an element in an iterator, returning its index. Read more1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
Returns the maximum element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
Returns the minimum element of an iterator. Read more1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the maximum value from the\n+specified function. Read more1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the maximum value with respect to the\n+specified comparison function. Read more1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the minimum value from the\n+specified function. Read more1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the minimum value with respect to the\n+specified comparison function. Read more1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
Converts an iterator of pairs into a pair of containers. Read more1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
Creates an iterator which copies all of its elements. Read moreSource\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_array_chunks
#100450)Returns an iterator over N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
Iterates over the entire iterator, multiplying all the elements Read moreSource\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n+of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
Lexicographically compares the PartialOrd
elements of\n+this Iterator
with those of another. The comparison works like short-circuit\n evaluation, returning a result without comparing the remaining elements.\n-As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n-of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
Checks if the elements of this iterator are sorted. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
Checks if the elements of this iterator are sorted using the given comparator function. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
Checks if the elements of this iterator are sorted using the given key extraction\n-function. Read moreSource\u00a7impl<T: Ord, A: Allocator> FusedIterator for IntoIterSorted<T, A>
Source\u00a7impl<T: Ord, A: Allocator> TrustedLen for IntoIterSorted<T, A>
Auto Trait Implementations\u00a7
\u00a7impl<T, A> Freeze for IntoIterSorted<T, A>where\n- A: Freeze,
\u00a7impl<T, A> RefUnwindSafe for IntoIterSorted<T, A>where\n- A: RefUnwindSafe,\n- T: RefUnwindSafe,
\u00a7impl<T, A> Send for IntoIterSorted<T, A>
\u00a7impl<T, A> Sync for IntoIterSorted<T, A>
\u00a7impl<T, A> Unpin for IntoIterSorted<T, A>
\u00a7impl<T, A> UnwindSafe for IntoIterSorted<T, A>where\n- A: UnwindSafe,\n- T: UnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moreSource\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
Source\u00a7fn into(self) -> U
Calls U::from(self)
.
\n+As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n+of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
Checks if the elements of this iterator are sorted. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
Checks if the elements of this iterator are sorted using the given comparator function. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
Checks if the elements of this iterator are sorted using the given key extraction\n+function. Read moreSource\u00a7impl<T: Ord, A: Allocator> FusedIterator for IntoIterSorted<T, A>
Source\u00a7impl<T: Ord, A: Allocator> TrustedLen for IntoIterSorted<T, A>
Auto Trait Implementations\u00a7
\u00a7impl<T, A> Freeze for IntoIterSorted<T, A>where\n+ A: Freeze,
\u00a7impl<T, A> RefUnwindSafe for IntoIterSorted<T, A>where\n+ A: RefUnwindSafe,\n+ T: RefUnwindSafe,
\u00a7impl<T, A> Send for IntoIterSorted<T, A>
\u00a7impl<T, A> Sync for IntoIterSorted<T, A>
\u00a7impl<T, A> Unpin for IntoIterSorted<T, A>
\u00a7impl<T, A> UnwindSafe for IntoIterSorted<T, A>where\n+ A: UnwindSafe,\n+ T: UnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moreSource\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7impl<I> IntoIterator for Iwhere\n- I: Iterator,
\n+From<T> for U
chooses to do.\n+
fn next_chunk<const N: usize>(\n+IntoIterSorted in alloc::collections::binary_heap - Rust pub struct IntoIterSorted<T, A: Allocator = Global> { /* private fields */ }
\ud83d\udd2cThis is a nightly-only experimental API. (binary_heap_into_iter_sorted
#59278)Implementations\u00a7
Trait Implementations\u00a7
Source\u00a7impl<T: Clone, A: Clone + Allocator> Clone for IntoIterSorted<T, A>
1.0.0 \u00b7 Source\u00a7fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read moreSource\u00a7impl<T: Ord, A: Allocator> ExactSizeIterator for IntoIterSorted<T, A>
Source\u00a7impl<T: Ord, A: Allocator> Iterator for IntoIterSorted<T, A>
Source\u00a7fn next(&mut self) -> Option<T>
Advances the iterator and returns the next value. Read moreSource\u00a7fn size_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator. Read moreSource\u00a7fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_next_chunk
#98326)Advances the iterator and returns an array containing the next N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n- Self: Sized,
Consumes the iterator, counting the number of iterations and returning it. Read more1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n- Self: Sized,
Consumes the iterator, returning the last element. Read moreSource\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_advance_by
#77404)Advances the iterator by n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
Creates an iterator starting at the same point, but stepping by\n-the given amount at each iteration. Read more1.0.0 \u00b7 Source\u00a7fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
Takes two iterators and creates a new iterator over both in sequence. Read more1.0.0 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
\u2018Zips up\u2019 two iterators into a single iterator of pairs. Read moreSource\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places a copy of separator
between adjacent\n-items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places an item generated by separator
\n-between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
Takes a closure and creates an iterator which calls that closure on each\n-element. Read more1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
Calls a closure on each element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
Creates an iterator which uses a closure to determine if an element\n-should be yielded. Read more1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
Creates an iterator that both filters and maps. Read more1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
Creates an iterator which gives the current iteration count as well as\n-the next value. Read more1.0.0 \u00b7 Source\u00a7fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
Creates an iterator which can use the peek
and peek_mut
methods\n+) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n+ Self: Sized,\ud83d\udd2cThis is a nightly-only experimental API. (iter_next_chunk
#98326)Advances the iterator and returns an array containing the next N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n+ Self: Sized,
Consumes the iterator, counting the number of iterations and returning it. Read more1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
Consumes the iterator, returning the last element. Read moreSource\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_advance_by
#77404)Advances the iterator by n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
Returns the n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
Creates an iterator starting at the same point, but stepping by\n+the given amount at each iteration. Read more1.0.0 \u00b7 Source\u00a7fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
Takes two iterators and creates a new iterator over both in sequence. Read more1.0.0 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
\u2018Zips up\u2019 two iterators into a single iterator of pairs. Read moreSource\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places a copy of separator
between adjacent\n+items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_intersperse
#79524)Creates a new iterator which places an item generated by separator
\n+between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
Takes a closure and creates an iterator which calls that closure on each\n+element. Read more1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
Calls a closure on each element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
Creates an iterator which uses a closure to determine if an element\n+should be yielded. Read more1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
Creates an iterator that both filters and maps. Read more1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
Creates an iterator which gives the current iteration count as well as\n+the next value. Read more1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Creates an iterator that yields elements based on a predicate. Read more1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
Creates an iterator that both yields elements based on a predicate and maps. Read more1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
Creates an iterator that skips the first n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
Creates an iterator that yields the first n
elements, or fewer\n-if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Creates an iterator that works like map, but flattens nested structure. Read more1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
Creates an iterator that flattens nested structure. Read moreSource\u00a7fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_map_windows
#87155)Calls the given function f
for each contiguous window of size N
over\n-self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n-the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
Does something with each element of an iterator, passing the value on. Read more1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
Borrows an iterator, rather than consuming it. Read more1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
Transforms an iterator into a collection. Read moreSource\u00a7fn try_collect<B>(\n+their documentation for more information. Read more
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Creates an iterator that yields elements based on a predicate. Read more1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
Creates an iterator that both yields elements based on a predicate and maps. Read more1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
Creates an iterator that skips the first n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
Creates an iterator that yields the first n
elements, or fewer\n+if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Creates an iterator that works like map, but flattens nested structure. Read more1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
Creates an iterator that flattens nested structure. Read moreSource\u00a7fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
\ud83d\udd2cThis is a nightly-only experimental API. (iter_map_windows
#87155)Calls the given function f
for each contiguous window of size N
over\n+self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n+the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
Does something with each element of an iterator, passing the value on. Read more1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
Borrows an iterator, rather than consuming it. Read more1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
Transforms an iterator into a collection. Read moreSource\u00a7fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n-a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n+such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n+successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n+iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n+returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n+operation. Read moreSource\u00a7fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_reduce
#87053)Reduces the elements to a single one by repeatedly applying a reducing operation. If the\n-closure returns a failure, the failure is propagated back to the caller immediately. Read more1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
Tests if every element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
Tests if any element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
Searches for an element of an iterator that satisfies a predicate. Read more1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
Applies function to the elements of iterator and returns\n-the first non-none result. Read moreSource\u00a7fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_reduce
#87053)Reduces the elements to a single one by repeatedly applying a reducing operation. If the\n+closure returns a failure, the failure is propagated back to the caller immediately. Read more1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
Tests if every element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
Tests if any element of the iterator matches a predicate. Read more1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
Searches for an element of an iterator that satisfies a predicate. Read more1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
Applies function to the elements of iterator and returns\n+the first non-none result. Read moreSource\u00a7fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
\ud83d\udd2cThis is a nightly-only experimental API. (try_find
#63178)Applies function to the elements of iterator and returns\n-the first true result or the first error. Read more1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
Searches for an element in an iterator, returning its index. Read more1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
Returns the maximum element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
Returns the minimum element of an iterator. Read more1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the maximum value from the\n-specified function. Read more1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the maximum value with respect to the\n-specified comparison function. Read more1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the minimum value from the\n-specified function. Read more1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the minimum value with respect to the\n-specified comparison function. Read more1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
Converts an iterator of pairs into a pair of containers. Read more1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
Creates an iterator which copies all of its elements. Read moreSource\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_array_chunks
#100450)Returns an iterator over N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
Iterates over the entire iterator, multiplying all the elements Read moreSource\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n-of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
Lexicographically compares the PartialOrd
elements of\n-this Iterator
with those of another. The comparison works like short-circuit\n+ f: impl FnMut(&Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypewhere\n+ Self: Sized,\n+ R: Try<Output = bool>,\n+ <R as Try>::Residual: Residual<Option<Self::Item>>,\ud83d\udd2cThis is a nightly-only experimental API. (try_find
#63178)Applies function to the elements of iterator and returns\n+the first true result or the first error. Read more1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
Searches for an element in an iterator, returning its index. Read more1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
Returns the maximum element of an iterator. Read more1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
Returns the minimum element of an iterator. Read more1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the maximum value from the\n+specified function. Read more1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the maximum value with respect to the\n+specified comparison function. Read more1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
Returns the element that gives the minimum value from the\n+specified function. Read more1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
Returns the element that gives the minimum value with respect to the\n+specified comparison function. Read more1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
Converts an iterator of pairs into a pair of containers. Read more1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
Creates an iterator which copies all of its elements. Read moreSource\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_array_chunks
#100450)Returns an iterator over N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
Iterates over the entire iterator, multiplying all the elements Read moreSource\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n+of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
Lexicographically compares the PartialOrd
elements of\n+this Iterator
with those of another. The comparison works like short-circuit\n evaluation, returning a result without comparing the remaining elements.\n-As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n-of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n-greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
Checks if the elements of this iterator are sorted. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
Checks if the elements of this iterator are sorted using the given comparator function. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
Checks if the elements of this iterator are sorted using the given key extraction\n-function. Read moreSource\u00a7impl<T: Ord, A: Allocator> FusedIterator for IntoIterSorted<T, A>
Source\u00a7impl<T: Ord, A: Allocator> TrustedLen for IntoIterSorted<T, A>
Auto Trait Implementations\u00a7
\u00a7impl<T, A> Freeze for IntoIterSorted<T, A>where\n- A: Freeze,
\u00a7impl<T, A> RefUnwindSafe for IntoIterSorted<T, A>where\n- A: RefUnwindSafe,\n- T: RefUnwindSafe,
\u00a7impl<T, A> Send for IntoIterSorted<T, A>
\u00a7impl<T, A> Sync for IntoIterSorted<T, A>
\u00a7impl<T, A> Unpin for IntoIterSorted<T, A>
\u00a7impl<T, A> UnwindSafe for IntoIterSorted<T, A>where\n- A: UnwindSafe,\n- T: UnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moreSource\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
Source\u00a7fn into(self) -> U
Calls U::from(self)
.
\n+As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)Lexicographically compares the elements of this Iterator
with those\n+of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
\ud83d\udd2cThis is a nightly-only experimental API. (iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
Determines if the elements of this Iterator
are lexicographically\n+greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
Checks if the elements of this iterator are sorted. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
Checks if the elements of this iterator are sorted using the given comparator function. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
Checks if the elements of this iterator are sorted using the given key extraction\n+function. Read moreSource\u00a7impl<T: Ord, A: Allocator> FusedIterator for IntoIterSorted<T, A>
Source\u00a7impl<T: Ord, A: Allocator> TrustedLen for IntoIterSorted<T, A>
Auto Trait Implementations\u00a7
\u00a7impl<T, A> Freeze for IntoIterSorted<T, A>where\n+ A: Freeze,
\u00a7impl<T, A> RefUnwindSafe for IntoIterSorted<T, A>where\n+ A: RefUnwindSafe,\n+ T: RefUnwindSafe,
\u00a7impl<T, A> Send for IntoIterSorted<T, A>
\u00a7impl<T, A> Sync for IntoIterSorted<T, A>
\u00a7impl<T, A> Unpin for IntoIterSorted<T, A>
\u00a7impl<T, A> UnwindSafe for IntoIterSorted<T, A>where\n+ A: UnwindSafe,\n+ T: UnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read moreSource\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7impl<I> IntoIterator for Iwhere\n- I: Iterator,
\n+From<T> for U
chooses to do.\n+
pub struct IntoIterSorted<T, A: Allocator = Global> { /* private fields */ }
binary_heap_into_iter_sorted
#59278)Implementations\u00a7
Trait Implementations\u00a7
Source\u00a7impl<T: Clone, A: Clone + Allocator> Clone for IntoIterSorted<T, A>
impl<T: Clone, A: Clone + Allocator> Clone for IntoIterSorted<T, A>
1.0.0 \u00b7 Source\u00a7fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource\u00a7impl<T: Ord, A: Allocator> ExactSizeIterator for IntoIterSorted<T, A>
impl<T: Ord, A: Allocator> ExactSizeIterator for IntoIterSorted<T, A>
Source\u00a7impl<T: Ord, A: Allocator> Iterator for IntoIterSorted<T, A>
impl<T: Ord, A: Allocator> Iterator for IntoIterSorted<T, A>
Source\u00a7fn next(&mut self) -> Option<T>
fn next(&mut self) -> Option<T>
Source\u00a7fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Source\u00a7fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n- Self: Sized,
fn count(self) -> usizewhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n- Self: Sized,
fn last(self) -> Option<Self::Item>where\n- Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n-items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n-between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
peek
and peek_mut
methods\n+) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n+ Self: Sized,
fn count(self) -> usizewhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
fn last(self) -> Option<Self::Item>where\n+ Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n+items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n+between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
n
elements, or fewer\n-if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n-self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n-the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n+their documentation for more information. Read more
fn try_collect<B>(\n+their documentation for more information. Read more
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
n
elements, or fewer\n+if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n+self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n+the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_reduce<R>(\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n-this Iterator
with those of another. The comparison works like short-circuit\n+ f: impl FnMut(&Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypetry_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n+this Iterator
with those of another. The comparison works like short-circuit\n evaluation, returning a result without comparing the remaining elements.\n-As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n- Self: Sized,\n- I: IntoIterator,\n- 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\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T: Ord, A: Allocator> FusedIterator for IntoIterSorted<T, A>
impl<T: Ord, A: Allocator> TrustedLen for IntoIterSorted<T, A>
Auto Trait Implementations\u00a7
impl<T, A> Freeze for IntoIterSorted<T, A>where\n- A: Freeze,
impl<T, A> RefUnwindSafe for IntoIterSorted<T, A>where\n- A: RefUnwindSafe,\n- T: RefUnwindSafe,
impl<T, A> Send for IntoIterSorted<T, A>
impl<T, A> Sync for IntoIterSorted<T, A>
impl<T, A> Unpin for IntoIterSorted<T, A>
impl<T, A> UnwindSafe for IntoIterSorted<T, A>where\n- A: UnwindSafe,\n- T: UnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
impl<T, U> Into<U> for Twhere\n- U: From<T>,
Source\u00a7fn into(self) -> U
fn into(self) -> U
Calls U::from(self)
.
Source\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n+ Self: Sized,\n+ I: IntoIterator,\n+ 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\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T: Ord, A: Allocator> FusedIterator for IntoIterSorted<T, A>
impl<T: Ord, A: Allocator> TrustedLen for IntoIterSorted<T, A>
Auto Trait Implementations\u00a7
impl<T, A> Freeze for IntoIterSorted<T, A>where\n+ A: Freeze,
impl<T, A> RefUnwindSafe for IntoIterSorted<T, A>where\n+ A: RefUnwindSafe,\n+ T: RefUnwindSafe,
impl<T, A> Send for IntoIterSorted<T, A>
impl<T, A> Sync for IntoIterSorted<T, A>
impl<T, A> Unpin for IntoIterSorted<T, A>
impl<T, A> UnwindSafe for IntoIterSorted<T, A>where\n+ A: UnwindSafe,\n+ T: UnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7impl<I> IntoIterator for Iwhere\n- I: Iterator,
impl<I> IntoIterator for Iwhere\n- I: Iterator,
From<T> for U
chooses to do.\n+Source\u00a7impl<I> IntoIterator for Iwhere\n+ I: Iterator,
impl<I> IntoIterator for Iwhere\n+ I: Iterator,
pub struct Iter<'a, T: 'a> { /* private fields */ }
Expand description
An iterator over the elements of a BinaryHeap
.
This struct
is created by BinaryHeap::iter()
. See its\n documentation for more.
Trait Implementations\u00a7
1.82.0 \u00b7 Source\u00a7impl<T> Default for Iter<'_, T>
impl<T> Default for Iter<'_, T>
Trait Implementations\u00a7
1.0.0 \u00b7 Source\u00a7impl<'a, T> DoubleEndedIterator for Iter<'a, T>
impl<'a, T> DoubleEndedIterator for Iter<'a, T>
Source\u00a7fn next_back(&mut self) -> Option<&'a T>
fn next_back(&mut self) -> Option<&'a T>
Source\u00a7fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.37.0 \u00b7 Source\u00a7fn 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 more1.27.0 \u00b7 Source\u00a7fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
Iterator::try_fold()
: it takes\n-elements starting from the back of the iterator. Read more1.0.0 \u00b7 Source\u00a7impl<T> ExactSizeIterator for Iter<'_, T>
impl<T> ExactSizeIterator for Iter<'_, T>
1.0.0 \u00b7 Source\u00a7impl<'a, T> Iterator for Iter<'a, T>
impl<'a, T> Iterator for Iter<'a, T>
Source\u00a7fn next(&mut self) -> Option<&'a T>
fn next(&mut self) -> Option<&'a T>
Source\u00a7fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Source\u00a7fn last(self) -> Option<&'a T>
fn last(self) -> Option<&'a T>
Source\u00a7fn next_chunk<const N: usize>(\n+
fn next_chunk<const N: usize>(\n+
1.0.0 \u00b7 Source\u00a7impl<'a, T> DoubleEndedIterator for Iter<'a, T>
impl<'a, T> DoubleEndedIterator for Iter<'a, T>
Source\u00a7fn next_back(&mut self) -> Option<&'a T>
fn next_back(&mut self) -> Option<&'a T>
Source\u00a7fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.37.0 \u00b7 Source\u00a7fn 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 more1.27.0 \u00b7 Source\u00a7fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
Iterator::try_fold()
: it takes\n+elements starting from the back of the iterator. Read more1.0.0 \u00b7 Source\u00a7impl<T> ExactSizeIterator for Iter<'_, T>
impl<T> ExactSizeIterator for Iter<'_, T>
1.0.0 \u00b7 Source\u00a7impl<'a, T> Iterator for Iter<'a, T>
impl<'a, T> Iterator for Iter<'a, T>
Source\u00a7fn next(&mut self) -> Option<&'a T>
fn next(&mut self) -> Option<&'a T>
Source\u00a7fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Source\u00a7fn last(self) -> Option<&'a T>
fn last(self) -> Option<&'a T>
Source\u00a7fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
fn next_chunk<const N: usize>(\n &mut self,\n-) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where\n- Self: Sized,
iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n- Self: Sized,
fn count(self) -> usizewhere\n- Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n- Self: Sized,\n- U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n-items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n-between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
fn peekable(self) -> Peekable<Self>where\n- Self: Sized,
peek
and peek_mut
methods\n+) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>iter_next_chunk
#98326)N
values. Read more1.0.0 \u00b7 Source\u00a7fn count(self) -> usizewhere\n+ Self: Sized,
fn count(self) -> usizewhere\n+ Self: Sized,
Source\u00a7fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
#77404)n
elements. Read more1.0.0 \u00b7 Source\u00a7fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read more1.28.0 \u00b7 Source\u00a7fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where\n+ Self: Sized,\n+ U: IntoIterator,
Source\u00a7fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
iter_intersperse
#79524)separator
between adjacent\n+items of the original iterator. Read moreSource\u00a7fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
#79524)separator
\n+between adjacent items of the original iterator. Read more1.0.0 \u00b7 Source\u00a7fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.21.0 \u00b7 Source\u00a7fn for_each<F>(self, f: F)
fn for_each<F>(self, f: F)
1.0.0 \u00b7 Source\u00a7fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 \u00b7 Source\u00a7fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 \u00b7 Source\u00a7fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
fn enumerate(self) -> Enumerate<Self>where\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n- Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n- Self: Sized,
n
elements, or fewer\n-if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n-self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n-the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n- Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n+their documentation for more information. Read more
fn try_collect<B>(\n+their documentation for more information. Read more
1.0.0 \u00b7 Source\u00a7fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 \u00b7 Source\u00a7fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 \u00b7 Source\u00a7fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where\n+ Self: Sized,
n
elements. Read more1.0.0 \u00b7 Source\u00a7fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
fn take(self, n: usize) -> Take<Self>where\n+ Self: Sized,
n
elements, or fewer\n+if the underlying iterator ends sooner. Read more1.0.0 \u00b7 Source\u00a7fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
1.29.0 \u00b7 Source\u00a7fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Source\u00a7fn 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
#87155)f
for each contiguous window of size N
over\n+self
and returns an iterator over the outputs of f
. Like slice::windows()
,\n+the windows during mapping overlap as well. Read more1.0.0 \u00b7 Source\u00a7fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 \u00b7 Source\u00a7fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere\n+ Self: Sized,
1.0.0 \u00b7 Source\u00a7fn collect<B>(self) -> B
fn collect<B>(self) -> B
Source\u00a7fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
fn try_collect<B>(\n &mut self,\n-) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usizewhere\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryTypewhere\n+ Self: Sized,\n+ Self::Item: Try,\n+ <Self::Item as Try>::Residual: Residual<B>,\n+ B: FromIterator<<Self::Item as Try>::Output>,\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n+ Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n+ P: FnMut(&T) -> bool,\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n such that all those that return true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
fn partition_in_place<'a, T, P>(self, predicate: P) -> usizewhere\n+) -> <<Self::Item as Try>::Residual as Residual<B>>::TryTypewhere\n+ Self: Sized,\n+ Self::Item: Try,\n+ <Self::Item as Try>::Residual: Residual<B>,\n+ B: FromIterator<<Self::Item as Try>::Output>,\ud83d\udd2cThis is a nightly-only experimental API. (iterator_try_collect
#94047)Fallibly transforms an iterator into a collection, short circuiting if\n+a failure is encountered. Read moreSource\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
\ud83d\udd2cThis is a nightly-only experimental API. (iter_collect_into
#94780)Collects all the items from an iterator into a collection. Read more1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
Consumes an iterator, creating two collections from it. Read moreSource\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n+ Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n+ P: FnMut(&T) -> bool,\ud83d\udd2cThis is a nightly-only experimental API. (iter_partition_in_place
#62543)Reorders the elements of this iterator in-place according to the given predicate,\n such that all those that return true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
\ud83d\udd2cThis is a nightly-only experimental API. (iter_is_partitioned
#62544)Checks if the elements of this iterator are partitioned according to the given predicate,\n-such that all those that return true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
An iterator method that applies a function as long as it returns\n-successfully, producing a single, final value. Read more1.27.0 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
An iterator method that applies a fallible function to each item in the\n-iterator, stopping at the first error and returning that error. Read more1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
Folds every element into an accumulator by applying an operation,\n-returning the final result. Read more1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
Reduces the elements to a single one, by repeatedly applying a reducing\n-operation. Read moreSource\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
iterator_try_collect
#94047)Source\u00a7fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
#94780)1.0.0 \u00b7 Source\u00a7fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
Source\u00a7fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
iter_partition_in_place
#62543)iter_partition_in_place
#62543)true
precede all those that return false
.\n-Returns the number of true
elements found. Read moreSource\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
fn try_reduce<R>(\n+Returns the number of true
elements found. Read more
Source\u00a7fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
#62544)true
precede all those that return false
. Read more1.27.0 \u00b7 Source\u00a7fn 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 \u00b7 Source\u00a7fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 \u00b7 Source\u00a7fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 \u00b7 Source\u00a7fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
Source\u00a7fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<R>(\n &mut self,\n- f: impl FnMut(Self::Item, Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_find<R>(\n+ f: impl FnMut(Self::Item, Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
#87053)1.0.0 \u00b7 Source\u00a7fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 \u00b7 Source\u00a7fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 \u00b7 Source\u00a7fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
Source\u00a7fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<R>(\n &mut self,\n- f: impl FnMut(&Self::Item) -> R,\n-) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn rposition<P>(&mut self, predicate: P) -> Option<usize>
fn rposition<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn rev(self) -> Rev<Self>where\n- Self: Sized + DoubleEndedIterator,
fn rev(self) -> Rev<Self>where\n- Self: Sized + DoubleEndedIterator,
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n- Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n-this Iterator
with those of another. The comparison works like short-circuit\n+ f: impl FnMut(&Self::Item) -> R,\n+) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryTypetry_find
#63178)1.0.0 \u00b7 Source\u00a7fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn rposition<P>(&mut self, predicate: P) -> Option<usize>
fn rposition<P>(&mut self, predicate: P) -> Option<usize>
1.0.0 \u00b7 Source\u00a7fn max(self) -> Option<Self::Item>
fn max(self) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn min(self) -> Option<Self::Item>
fn min(self) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 \u00b7 Source\u00a7fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 \u00b7 Source\u00a7fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 \u00b7 Source\u00a7fn rev(self) -> Rev<Self>where\n+ Self: Sized + DoubleEndedIterator,
fn rev(self) -> Rev<Self>where\n+ Self: Sized + DoubleEndedIterator,
1.0.0 \u00b7 Source\u00a7fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 \u00b7 Source\u00a7fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Source\u00a7fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where\n+ Self: Sized,
iter_array_chunks
#100450)N
elements of the iterator at a time. Read more1.11.0 \u00b7 Source\u00a7fn product<P>(self) -> P
fn product<P>(self) -> P
Source\u00a7fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
fn cmp_by<I, F>(self, other: I, cmp: F) -> Orderingwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read more1.5.0 \u00b7 Source\u00a7fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
PartialOrd
elements of\n+this Iterator
with those of another. The comparison works like short-circuit\n evaluation, returning a result without comparing the remaining elements.\n-As soon as an order can be determined, the evaluation stops and a result is returned. Read moreSource\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n- Self: Sized,\n- I: IntoIterator,\n- 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\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n-of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n- Self: Sized,\n- I: IntoIterator,\n- F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n-less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n-greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T> FusedIterator for Iter<'_, T>
Auto Trait Implementations\u00a7
impl<'a, T> Freeze for Iter<'a, T>
impl<'a, T> RefUnwindSafe for Iter<'a, T>where\n- T: RefUnwindSafe,
impl<'a, T> Send for Iter<'a, T>where\n- T: Sync,
impl<'a, T> Sync for Iter<'a, T>where\n- T: Sync,
impl<'a, T> Unpin for Iter<'a, T>
impl<'a, T> UnwindSafe for Iter<'a, T>where\n- T: RefUnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n- T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n- T: Clone,
impl<T> CloneToUninit for Twhere\n- T: Clone,
Source\u00a7impl<T, U> Into<U> for Twhere\n- U: From<T>,
impl<T, U> Into<U> for Twhere\n- U: From<T>,
Source\u00a7fn into(self) -> U
fn into(self) -> U
Calls U::from(self)
.
Source\u00a7fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where\n+ Self: Sized,\n+ I: IntoIterator,\n+ 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\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
#64295)Iterator
with those\n+of another with respect to the specified comparison function. Read moreSource\u00a7fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
fn eq_by<I, F>(self, other: I, eq: F) -> boolwhere\n+ Self: Sized,\n+ I: IntoIterator,\n+ F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,
iter_order_by
#64295)1.5.0 \u00b7 Source\u00a7fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less than those of another. Read more1.5.0 \u00b7 Source\u00a7fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically\n+less or equal to those of another. Read more1.5.0 \u00b7 Source\u00a7fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than those of another. Read more1.5.0 \u00b7 Source\u00a7fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically\n+greater than or equal to those of another. Read more1.82.0 \u00b7 Source\u00a7fn is_sorted(self) -> bool
fn is_sorted(self) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
1.82.0 \u00b7 Source\u00a7fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
impl<T> FusedIterator for Iter<'_, T>
Auto Trait Implementations\u00a7
impl<'a, T> Freeze for Iter<'a, T>
impl<'a, T> RefUnwindSafe for Iter<'a, T>where\n+ T: RefUnwindSafe,
impl<'a, T> Send for Iter<'a, T>where\n+ T: Sync,
impl<'a, T> Sync for Iter<'a, T>where\n+ T: Sync,
impl<'a, T> Unpin for Iter<'a, T>
impl<'a, T> UnwindSafe for Iter<'a, T>where\n+ T: RefUnwindSafe,
Blanket Implementations\u00a7
Source\u00a7impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
impl<T> BorrowMut<T> for Twhere\n+ T: ?Sized,
Source\u00a7fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source\u00a7impl<T> CloneToUninit for Twhere\n+ T: Clone,
impl<T> CloneToUninit for Twhere\n+ T: Clone,
Source\u00a7impl<I> IntoIterator for Iwhere\n- I: Iterator,
impl<I> IntoIterator for Iwhere\n- I: Iterator,
From<T> for U
chooses to do.\n+