SepBy

Trait SepBy 

Source
pub trait SepBy: IntoIterator
where <Self as IntoIterator>::IntoIter: Clone,
{ // Required methods fn sep_by<S: Separator + ?Sized>( self, sep: &S, ) -> SepBy<'_, Self::IntoIter, S>; fn sep_by_write_into<S: Separator + ?Sized>( self, sep: &S, ) -> SepBy<'_, Self::IntoIter, S> where Self::Item: WriteInto; }
Expand description

Create a new object using given iterator and separator.

Note that this is a trait, and you can use it with any type that implements IntoIterator and whose IntoIterator::IntoIter implements Clone.

§Examples

use iof::SepBy;
let v = vec![1, 2, 3];
let s = format!("{}", v.sep_by(", "));
assert_eq!(s, "1, 2, 3");

Required Methods§

Source

fn sep_by<S: Separator + ?Sized>(self, sep: &S) -> SepBy<'_, Self::IntoIter, S>

Create an object that implement core::fmt::Display using given iterator and separator.

Source

fn sep_by_write_into<S: Separator + ?Sized>( self, sep: &S, ) -> SepBy<'_, Self::IntoIter, S>
where Self::Item: WriteInto,

Create an object that implement WriteInto using given iterator and separator.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I: IntoIterator> SepBy for I
where I::IntoIter: Clone,