Skip to main content

join

Function join 

Source
pub fn join(
    iterable: impl IntoIterator<Item = impl DisplayBytes>,
    separator: impl DisplayBytes,
) -> impl DisplayBytes
Expand description

Format a sequence of values with the given separator repeated between any two consecutive values, but not at the start or end of the sequence.

It is visited with Visit::seq.

ยงExample

use format_bytes::{format_bytes, join};

let formatted = format_bytes!(b"Got {}.", join(&[4, 3, 2], b" and "));
assert_eq!(formatted, b"Got 4 and 3 and 2.");