mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Expose iter::ByRefSized as unstable feature and use it
This commit is contained in:
parent
bc3fae4dc1
commit
ce3b6f505e
@ -1,6 +1,6 @@
|
||||
use crate::alloc::Allocator;
|
||||
use crate::vec;
|
||||
use core::iter::TrustedLen;
|
||||
use core::iter::{ByRefSized, TrustedLen};
|
||||
use core::slice;
|
||||
|
||||
use super::VecDeque;
|
||||
|
@ -143,6 +143,7 @@
|
||||
#![feature(unchecked_math)]
|
||||
#![feature(unicode_internals)]
|
||||
#![feature(unsize)]
|
||||
#![feature(std_internals)]
|
||||
//
|
||||
// Language features:
|
||||
#![feature(allocator_internals)]
|
||||
|
@ -4,8 +4,11 @@ use crate::ops::Try;
|
||||
///
|
||||
/// Ideally this will no longer be required, eventually, but as can be seen in
|
||||
/// the benchmarks (as of Feb 2022 at least) `by_ref` can have performance cost.
|
||||
pub(crate) struct ByRefSized<'a, I>(pub &'a mut I);
|
||||
#[unstable(feature = "std_internals", issue = "none")]
|
||||
#[derive(Debug)]
|
||||
pub struct ByRefSized<'a, I>(pub &'a mut I);
|
||||
|
||||
#[unstable(feature = "std_internals", issue = "none")]
|
||||
impl<I: Iterator> Iterator for ByRefSized<'_, I> {
|
||||
type Item = I::Item;
|
||||
|
||||
@ -47,6 +50,7 @@ impl<I: Iterator> Iterator for ByRefSized<'_, I> {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "std_internals", issue = "none")]
|
||||
impl<I: DoubleEndedIterator> DoubleEndedIterator for ByRefSized<'_, I> {
|
||||
#[inline]
|
||||
fn next_back(&mut self) -> Option<Self::Item> {
|
||||
|
@ -32,7 +32,8 @@ pub use self::{
|
||||
scan::Scan, skip::Skip, skip_while::SkipWhile, take::Take, take_while::TakeWhile, zip::Zip,
|
||||
};
|
||||
|
||||
pub(crate) use self::by_ref_sized::ByRefSized;
|
||||
#[unstable(feature = "std_internals", issue = "none")]
|
||||
pub use self::by_ref_sized::ByRefSized;
|
||||
|
||||
#[stable(feature = "iter_cloned", since = "1.1.0")]
|
||||
pub use self::cloned::Cloned;
|
||||
|
@ -398,6 +398,8 @@ pub use self::traits::{
|
||||
|
||||
#[stable(feature = "iter_zip", since = "1.59.0")]
|
||||
pub use self::adapters::zip;
|
||||
#[unstable(feature = "std_internals", issue = "none")]
|
||||
pub use self::adapters::ByRefSized;
|
||||
#[stable(feature = "iter_cloned", since = "1.1.0")]
|
||||
pub use self::adapters::Cloned;
|
||||
#[stable(feature = "iter_copied", since = "1.36.0")]
|
||||
@ -422,7 +424,7 @@ pub use self::adapters::{
|
||||
#[unstable(feature = "iter_intersperse", reason = "recently added", issue = "79524")]
|
||||
pub use self::adapters::{Intersperse, IntersperseWith};
|
||||
|
||||
pub(crate) use self::adapters::{try_process, ByRefSized};
|
||||
pub(crate) use self::adapters::try_process;
|
||||
|
||||
mod adapters;
|
||||
mod range;
|
||||
|
Loading…
Reference in New Issue
Block a user