language_reporting

Struct Join

Source
pub struct Join<U, Iterator>
where Iterator: IntoIterator<Item = U>,
{ pub iterator: Iterator, pub joiner: &'static str, }
Expand description

Equivalent to Each(), but inserts a joiner between two adjacent elements.

§Example

struct Point(i32, i32);

let items = vec![Point(10, 20), Point(5, 10), Point(6, 42)];

let document = Document::with(Join(
    (&items, ", "),
    |item, doc| doc.add("Point(").add(item.0).add(",").add(item.1).add(")")
));

assert_eq!(document.to_string()?, "Point(10,20), Point(5,10), Point(6,42)");

Fields§

§iterator: Iterator§joiner: &'static str

Trait Implementations§

Source§

impl<U, I> From<(I, &'static str)> for Join<U, I>
where I: IntoIterator<Item = U>,

Source§

fn from(from: (I, &'static str)) -> Join<U, I>

Converts to this type from the input type.
Source§

impl<'item, U, Iterator> IterBlockComponent for Join<U, Iterator>
where Iterator: IntoIterator<Item = U>,

Source§

type Item = U

Source§

fn append( self, block: impl FnMut(<Join<U, Iterator> as IterBlockComponent>::Item, Document) -> Document, into: Document, ) -> Document

Source§

fn with<F>(component: Self, block: F) -> CurriedIterBlockComponent<Self, F>
where F: FnMut(Self::Item, Document) -> Document,

Auto Trait Implementations§

§

impl<U, Iterator> Freeze for Join<U, Iterator>
where Iterator: Freeze,

§

impl<U, Iterator> RefUnwindSafe for Join<U, Iterator>
where Iterator: RefUnwindSafe,

§

impl<U, Iterator> Send for Join<U, Iterator>
where Iterator: Send,

§

impl<U, Iterator> Sync for Join<U, Iterator>
where Iterator: Sync,

§

impl<U, Iterator> Unpin for Join<U, Iterator>
where Iterator: Unpin,

§

impl<U, Iterator> UnwindSafe for Join<U, Iterator>
where Iterator: 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> 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, 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.