Function format_bytes::join[][src]

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.

The return value can be formatted with DisplayBytes once. Formatting consumes the input iterator. Formatting again will produce an empty output.

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.");