Struct core_extensions::iterators::IterCloner
source · [−]pub struct IterCloner<'a, I: 'a>(pub &'a I);
Available on crate feature
iterators
only.Expand description
Implements IntoIterator::into_iter
by cloning the iterator it references.
You can also use the iter_cloner
macro to
construct this,
Example
use core_extensions::iterators::IterCloner;
let list = vec!["hello", "awesome", "world"];
let iter = list.iter().map(|v|v.len()).filter(|&v| v<6 );
let iter_clone = IterCloner(&iter);
for _ in 0..2{
assert_eq!(iter_clone.into_iter().collect::<Vec<_>>(), vec![5, 5]);
}
Tuple Fields
0: &'a I
Trait Implementations
sourceimpl<'a, I> Clone for IterCloner<'a, I>
impl<'a, I> Clone for IterCloner<'a, I>
sourceimpl<'a, I: Debug + 'a> Debug for IterCloner<'a, I>
impl<'a, I: Debug + 'a> Debug for IterCloner<'a, I>
sourceimpl<'a, I: 'a> IntoIterator for IterCloner<'a, I> where
I: Iterator + Clone,
impl<'a, I: 'a> IntoIterator for IterCloner<'a, I> where
I: Iterator + Clone,
impl<'a, I> Copy for IterCloner<'a, I>
Auto Trait Implementations
impl<'a, I> RefUnwindSafe for IterCloner<'a, I> where
I: RefUnwindSafe,
impl<'a, I> Send for IterCloner<'a, I> where
I: Sync,
impl<'a, I> Sync for IterCloner<'a, I> where
I: Sync,
impl<'a, I> Unpin for IterCloner<'a, I>
impl<'a, I> UnwindSafe for IterCloner<'a, I> where
I: RefUnwindSafe,
Blanket Implementations
sourceimpl<T> AsPhantomData for T where
T: ?Sized,
impl<T> AsPhantomData for T where
T: ?Sized,
sourcefn as_phantom(&self) -> PhantomData<Self>
fn as_phantom(&self) -> PhantomData<Self>
Available on crate feature
phantom
only.Gets a PhantomData<Self>
. Read more
sourcefn as_phantom_covariant(&self) -> PhantomData<fn() -> Self>
fn as_phantom_covariant(&self) -> PhantomData<fn() -> Self>
Available on crate feature
phantom
only.Gets a PhantomData<fn() -> Self>
, a covariant PhantomData
.
sourcefn as_phantom_contra(&self) -> PhantomData<fn(_: Self)>
fn as_phantom_contra(&self) -> PhantomData<fn(_: Self)>
Available on crate feature
phantom
only.Gets a PhantomData<fn(Self)>
, a contravariant PhantomData
.
sourcefn as_phantom_invariant(&self) -> PhantomData<fn(_: Self) -> Self>
fn as_phantom_invariant(&self) -> PhantomData<fn(_: Self) -> Self>
Available on crate feature
phantom
only.Gets a PhantomData<fn(Self) -> Self>
, an invariant PhantomData
.
sourceconst PHANTOM: PhantomData<Self> = PhantomData
const PHANTOM: PhantomData<Self> = PhantomData
Available on crate feature
phantom
only.Gets a PhantomData<Self>
. Read more
sourceconst PHANTOM_COVARIANT: PhantomData<fn() -> Self> = PhantomData
const PHANTOM_COVARIANT: PhantomData<fn() -> Self> = PhantomData
Available on crate feature
phantom
only.Constructs a PhantomData<fn() -> T>
, a covariant PhantomData
. Read more
sourceconst PHANTOM_CONTRA: PhantomData<fn(_: Self)> = PhantomData
const PHANTOM_CONTRA: PhantomData<fn(_: Self)> = PhantomData
Available on crate feature
phantom
only.Gets a PhantomData<fn(Self)>
, a contravariant PhantomData
. Read more
sourceconst PHANTOM_INVARIANT: PhantomData<fn(_: Self) -> Self> = PhantomData
const PHANTOM_INVARIANT: PhantomData<fn(_: Self) -> Self> = PhantomData
Available on crate feature
phantom
only.Gets a PhantomData<fn(Self) -> Self>
, an invariant PhantomData
. Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallExt for T where
T: ?Sized,
impl<T> CallExt for T where
T: ?Sized,
sourcefn ref_call<P>(&self, params: P) -> Self::Returns where
Self: CallRef<P>,
fn ref_call<P>(&self, params: P) -> Self::Returns where
Self: CallRef<P>,
Available on crate feature
callable
only.For calling CallRef::ref_call_
,
with the ability to specify the types of the arguments.. Read more