pub struct Literate<I> { /* private fields */ }Expand description
Adds Display/Debug formatting to any iterator whose items implement
Display and/or Debug.
All formatting arguments are passed through to each item’s Display/Debug
implementation.
Implementations§
Source§impl<I: Sized> Literate<I>
impl<I: Sized> Literate<I>
Sourcepub fn into_inner(self) -> Option<I>
pub fn into_inner(self) -> Option<I>
Consumes the Literate and returns the inner iterator. Returns None
if the object has been formatted already.
Sourcepub fn map_iterator<F, O>(self, f: F) -> Literate<O>where
F: FnOnce(I) -> O,
pub fn map_iterator<F, O>(self, f: F) -> Literate<O>where
F: FnOnce(I) -> O,
Convert the inner iterator to another inner iterator.
Trait Implementations§
Source§impl<I> Literator for Literate<I>
impl<I> Literator for Literate<I>
Source§fn into_option_iter(self) -> Option<Self::Iter>
fn into_option_iter(self) -> Option<Self::Iter>
Convert this literator into an
Option of its iterator.Source§fn join<D>(self, delim: D) -> Join<Self::Iter, D>
fn join<D>(self, delim: D) -> Join<Self::Iter, D>
Wrap the iterator in an object implementing
Display/Debug that
prints each item separated by a delimiter. Read moreSource§fn concat(self) -> Literate<Self::Iter>where
Self: Sized,
fn concat(self) -> Literate<Self::Iter>where
Self: Sized,
Concatenate all items into a single string, using each item’s
Display
or Debug implementation. Read moreSource§fn conjunctive_join_custom<Delim, LastDelim>(
self,
delim: Delim,
last_delim: LastDelim,
) -> ConjunctiveJoin<Self::Iter, Delim, LastDelim>
fn conjunctive_join_custom<Delim, LastDelim>( self, delim: Delim, last_delim: LastDelim, ) -> ConjunctiveJoin<Self::Iter, Delim, LastDelim>
Join the items using
delim between the first N-1 elements, and
last_delim between the next-to-last and last items. Read moreSource§fn join_and(self) -> ConjunctiveJoin<Self::Iter>where
Self: Sized,
fn join_and(self) -> ConjunctiveJoin<Self::Iter>where
Self: Sized,
Join the items separated by
", " between each item, except " and "
(no comma) between the next-to-last and last items. Read moreSource§fn join_or(self) -> ConjunctiveJoin<Self::Iter>where
Self: Sized,
fn join_or(self) -> ConjunctiveJoin<Self::Iter>where
Self: Sized,
Join the items separated by
", " between each item, except " or "
(no comma) between the next-to-last and last items.Source§fn join_comma_and(self) -> ConjunctiveJoin<Self::Iter>where
Self: Sized,
fn join_comma_and(self) -> ConjunctiveJoin<Self::Iter>where
Self: Sized,
Join the items separated by
", " between each item, except ", and "
(with comma) between the next-to-last and last items. Read moreSource§fn join_comma_or(self) -> ConjunctiveJoin<Self::Iter>where
Self: Sized,
fn join_comma_or(self) -> ConjunctiveJoin<Self::Iter>where
Self: Sized,
Join the items separated by
", " between each item, except ", or "
(with comma) between the next-to-last and last items.Source§fn oxford_join_custom<Delim, ExactlyTwo, Final>(
self,
first_n: Delim,
exactly_two_conjunction: ExactlyTwo,
final_delim_conjunction: Final,
) -> OxfordJoin<Self::Iter, Delim, ExactlyTwo, Final>
fn oxford_join_custom<Delim, ExactlyTwo, Final>( self, first_n: Delim, exactly_two_conjunction: ExactlyTwo, final_delim_conjunction: Final, ) -> OxfordJoin<Self::Iter, Delim, ExactlyTwo, Final>
Join items using serial comma (“Oxford comma”, “Harvard comma”). Read more
Source§fn oxford_join_and(self) -> OxfordJoin<Self::Iter>where
Self: Sized,
fn oxford_join_and(self) -> OxfordJoin<Self::Iter>where
Self: Sized,
Oxford join with commas and English “and”. Read more
Source§fn oxford_join_or(self) -> OxfordJoin<Self::Iter>where
Self: Sized,
fn oxford_join_or(self) -> OxfordJoin<Self::Iter>where
Self: Sized,
Oxford join with commas and English “or”. Read more
Source§fn oxford_join_semicolon_and(self) -> OxfordJoin<Self::Iter>where
Self: Sized,
fn oxford_join_semicolon_and(self) -> OxfordJoin<Self::Iter>where
Self: Sized,
Oxford join with semicolons and English “and”. Read more
Source§fn oxford_join_semicolon_or(self) -> OxfordJoin<Self::Iter>where
Self: Sized,
fn oxford_join_semicolon_or(self) -> OxfordJoin<Self::Iter>where
Self: Sized,
Oxford join with semicolons and English “or”. Read more
Source§fn format_each_with<F>(
self,
with: F,
) -> Literate<impl Iterator<Item = FormatWith<Self::Item, F>>>
fn format_each_with<F>( self, with: F, ) -> Literate<impl Iterator<Item = FormatWith<Self::Item, F>>>
Produce an iterator where each item’s
Display/Debug implementation
is overridden by the function with. Read moreSource§fn capitalize_first(self) -> Literate<impl Iterator<Item: Display>>
fn capitalize_first(self) -> Literate<impl Iterator<Item: Display>>
Capitalize the first item in the list. Read more
Source§fn prefix_each_with<F>(
self,
with: F,
) -> Literate<impl Iterator<Item = PrefixWith<Self::Item, F>>>
fn prefix_each_with<F>( self, with: F, ) -> Literate<impl Iterator<Item = PrefixWith<Self::Item, F>>>
Produce an iterator where each item’s
Display/Debug implementation
writes a custom prefix before the item. Read moreSource§fn suffix_each_with<F>(
self,
with: F,
) -> Literate<impl Iterator<Item = SuffixWith<Self::Item, F>>>
fn suffix_each_with<F>( self, with: F, ) -> Literate<impl Iterator<Item = SuffixWith<Self::Item, F>>>
Produce an iterator where each item’s
Display/Debug implementation
writes a custom suffix after the item. Read moreSource§fn prefix_each<P>(
self,
prefix: P,
) -> Literate<impl Iterator<Item = Prefix<Self::Item, P>>>
fn prefix_each<P>( self, prefix: P, ) -> Literate<impl Iterator<Item = Prefix<Self::Item, P>>>
Produce an iterator where each item’s
Display/Debug implementation
writes prefix before the item. Read moreSource§fn suffix_each<S>(
self,
suffix: S,
) -> Literate<impl Iterator<Item = Suffix<Self::Item, S>>>
fn suffix_each<S>( self, suffix: S, ) -> Literate<impl Iterator<Item = Suffix<Self::Item, S>>>
Produce an iterator where each item’s
Display/Debug implementation
writes suffix after the item. Read moreSource§fn surround_each<P, S>(
self,
prefix: P,
suffix: S,
) -> Literate<impl Iterator<Item = Surround<Self::Item, P, S>>>
fn surround_each<P, S>( self, prefix: P, suffix: S, ) -> Literate<impl Iterator<Item = Surround<Self::Item, P, S>>>
Produce an iterator where each item’s
Display/Debug implementation
writes prefix before and suffix after the item. Read moreSource§fn indent_each(
self,
level: usize,
) -> Literate<impl Iterator<Item = Surround<Self::Item, Repeat<&'static str>, char>>>where
Self: Sized,
fn indent_each(
self,
level: usize,
) -> Literate<impl Iterator<Item = Surround<Self::Item, Repeat<&'static str>, char>>>where
Self: Sized,
Print each item prefixed by indentation, where each level of indentation
is 4 spaces, and suffix each item with a newline. Read more
Source§fn indent_each_custom<P, S>(
self,
level: usize,
indentation: P,
newline: S,
) -> Literate<impl Iterator<Item = Surround<Self::Item, Repeat<P>, S>>>
fn indent_each_custom<P, S>( self, level: usize, indentation: P, newline: S, ) -> Literate<impl Iterator<Item = Surround<Self::Item, Repeat<P>, S>>>
Print each item with custom indentation. The
indentation string is repeated
level times before each item, and newline is appended after each item.Source§fn indented_block<Open, Close>(
self,
open: Open,
close: Close,
inner_level: usize,
) -> IndentedBlock<Self::Iter, Open, Close, &'static str, char>
fn indented_block<Open, Close>( self, open: Open, close: Close, inner_level: usize, ) -> IndentedBlock<Self::Iter, Open, Close, &'static str, char>
Source§fn indented_block_custom<Open, Close, Indentation, Newline>(
self,
open: Open,
close: Close,
inner_level: usize,
indentation: Indentation,
newline: Newline,
) -> IndentedBlock<Self::Iter, Open, Close, Indentation, Newline>
fn indented_block_custom<Open, Close, Indentation, Newline>( self, open: Open, close: Close, inner_level: usize, indentation: Indentation, newline: Newline, ) -> IndentedBlock<Self::Iter, Open, Close, Indentation, Newline>
Same as
indented_block(), but with custom
indentation and newline tokens. Read moreSource§fn inline_block<P, D, S>(
self,
open: P,
delim: D,
close: S,
) -> InlineBlock<Self::Iter, P, D, S>
fn inline_block<P, D, S>( self, open: P, delim: D, close: S, ) -> InlineBlock<Self::Iter, P, D, S>
Auto Trait Implementations§
impl<I> !Freeze for Literate<I>
impl<I> !RefUnwindSafe for Literate<I>
impl<I> !Sync for Literate<I>
impl<I> Send for Literate<I>where
I: Send,
impl<I> Unpin for Literate<I>where
I: Unpin,
impl<I> UnsafeUnpin for Literate<I>where
I: UnsafeUnpin,
impl<I> UnwindSafe for Literate<I>where
I: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more