pub(crate) trait Joined: IntoIterator {
// Required method
fn joined(self, sep: impl Display, f: &mut Formatter<'_>) -> Result;
}
Required Methods§
Sourcefn joined(self, sep: impl Display, f: &mut Formatter<'_>) -> Result
fn joined(self, sep: impl Display, f: &mut Formatter<'_>) -> Result
Takes an iterator over elements that implement Display
, and format them into f
, separated by sep
.
This is similar to Itertools::format
, but instead of returning an implementation of Display
,
it formats directly into a Formatter
.
The performance of joined
is slightly better than format
, since it doesn’t need to use a Cell
to keep track of whether fmt
was already called (joined
’s API doesn’t allow it be called more than once).
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.