Struct ByRefSized

pub struct ByRefSized<'a, I>(pub &'a mut I);

Like Iterator::by_ref, but requiring Sized so it can forward generics.

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.

Fields

0: &'a mut I

Trait Implementations

impl<'a, I: Debug> Debug for ByRefSized<'a, I>

fn fmt(&self, f: &mut Formatter<'_>) -> Result

impl<I: DoubleEndedIterator> DoubleEndedIterator for ByRefSized<'_, I>

fn next_back(&mut self) -> Option<Self::Item>
fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn nth_back(&mut self, n: usize) -> Option<Self::Item>
fn rfold<B, F>(self, init: B, f: F) -> B
where
    F: FnMut(B, Self::Item) -> B,
fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where
    F: FnMut(B, Self::Item) -> R,
    R: Try<Output = B>,

impl<I: Iterator> Iterator for ByRefSized<'_, I>

type Item = <I as Iterator>::Item;
fn next(&mut self) -> Option<Self::Item>
fn size_hint(&self) -> (usize, Option<usize>)
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn nth(&mut self, n: usize) -> Option<Self::Item>
fn fold<B, F>(self, init: B, f: F) -> B
where
    F: FnMut(B, Self::Item) -> B,
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where
    F: FnMut(B, Self::Item) -> R,
    R: Try<Output = B>,

Auto Trait Implementations

impl<'a, I> !UnwindSafe for ByRefSized<'a, I>

impl<'a, I> Freeze for ByRefSized<'a, I> where &'a mut I: Freeze,

impl<'a, I> RefUnwindSafe for ByRefSized<'a, I> where &'a mut I: RefUnwindSafe,

impl<'a, I> Send for ByRefSized<'a, I> where &'a mut I: Send,

impl<'a, I> Sync for ByRefSized<'a, I> where &'a mut I: Sync,

impl<'a, I> Unpin for ByRefSized<'a, I> where &'a mut I: Unpin,

impl<'a, I> UnsafeUnpin for ByRefSized<'a, I> where &'a mut I: UnsafeUnpin,

Blanket Implementations

impl<I> IntoIterator for ByRefSized<'a, I> where I: Iterator,

type Item = <I as Iterator>::Item;
type IntoIter = I;
fn into_iter(self) -> I

impl<T> Any for ByRefSized<'a, I> where T: 'static + ?Sized,

fn type_id(&self) -> TypeId

impl<T> Borrow<T> for ByRefSized<'a, I> where T: ?Sized,

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for ByRefSized<'a, I> where T: ?Sized,

fn borrow_mut(&mut self) -> &mut T

impl<T> From<T> for ByRefSized<'a, I>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> SizeHint for ByRefSized<'a, I> where T: ?Sized,

fn lower_bound(&self) -> usize
fn upper_bound(&self) -> Option<usize>

impl<T> SizedTypeProperties for ByRefSized<'a, I>

impl<T, U> Into<U> for ByRefSized<'a, I> where U: From<T>,

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom<U> for ByRefSized<'a, I> where U: Into<T>,

type Error = Infallible;
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto<U> for ByRefSized<'a, I> where U: TryFrom<T>,

type Error = <U as TryFrom<T>>::Error;
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>