Skip to main content

message

Macro message 

Source
macro_rules! message {
    ($($args: tt)*) => { ... };
}
Expand description

Creates a Message: like format_bytes!, but the arguments are kept, for a Sink to write later.

Arguments are moved into the message, so they must be 'static, Send and Sync.

ยงExample

use format_bytes::message;

let rev = 42;
let msg = message!("unknown revision {rev} in {path}", path = b"caf\xe9".to_vec());

let mut out = vec![];
msg.write_to(&mut out).unwrap();
assert_eq!(out, b"unknown revision 42 in caf\xe9");
assert_eq!(msg.template().source, "unknown revision {rev} in {path}");