joinery::iter

Struct CloneIterator

Source
pub struct CloneIterator<I>(/* private fields */);
Expand description

Specialized helper struct to allow adapting any Iterator into a Join.

Join requires the underlying object to be &T: IntoIterator, so that it can be iterated over when formatting via Display. This works fine for collection types like Vec, but it doesn’t work for arbitrary iterators. However, because many iterators are cheaply clonable (because they often just contain a reference to the underlying sequence), we can use this adapter to create an &T: IntoIterator type which can be displayed by Join.

Trait Implementations§

Source§

impl<I: Clone> Clone for CloneIterator<I>

Source§

fn clone(&self) -> CloneIterator<I>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<I: Debug> Debug for CloneIterator<I>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'a, I: Iterator + Clone> IntoIterator for &'a CloneIterator<I>

Source§

fn into_iter(self) -> Self::IntoIter

Create a referential iterator by cloning the underlying iterator. Note that this will have the same Item type as the underlying iterator, rather than references to those items.

Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

impl<I: Iterator> IntoIterator for CloneIterator<I>

Source§

fn into_iter(self) -> Self::IntoIter

Convert the adapter back into the underlying iterator.

Source§

type IntoIter = I

Which kind of iterator are we turning this into?
Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

impl<I: PartialEq> PartialEq for CloneIterator<I>

Source§

fn eq(&self, other: &CloneIterator<I>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<I: Eq> Eq for CloneIterator<I>

Source§

impl<I> StructuralPartialEq for CloneIterator<I>

Auto Trait Implementations§

§

impl<I> Freeze for CloneIterator<I>
where I: Freeze,

§

impl<I> RefUnwindSafe for CloneIterator<I>
where I: RefUnwindSafe,

§

impl<I> Send for CloneIterator<I>
where I: Send,

§

impl<I> Sync for CloneIterator<I>
where I: Sync,

§

impl<I> Unpin for CloneIterator<I>
where I: Unpin,

§

impl<I> UnwindSafe for CloneIterator<I>
where I: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> Joinable for T
where &'a T: for<'a> IntoIterator,

Source§

type Collection = T

Source§

fn join_with<S>(self, sep: S) -> Join<T, S>

Combine this object with a separator to create a new Join instance. Note that the separator does not have to share the same type as the iterator’s values. Read more
Source§

fn join_concat(self) -> Join<Self::Collection, NoSeparator>

Join this object with an empty separator. When rendered with Display, the underlying elements will be directly concatenated. Note that the separator, while empty, is still present, and will show up if you iterate this instance. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.