Function fmty::concat_once
source · pub fn concat_once<I: IntoIterator>(iter: I) -> ConcatOnce<I::IntoIter>
Expand description
Concatenates Iterator
items, at most once.
This is a non-Clone
alternative to concat()
. It uses interior
mutability to take ownership of the iterator in the first call to
Display::fmt()
. As a result, ConcatOnce
does not implement Sync
.
Examples
let value = fmty::concat_once(["hola", "mundo"]);
assert_eq!(value.to_string(), "holamundo");
assert_eq!(value.to_string(), "");