Macro custom_print::define_print
source · macro_rules! define_print { ( $( #[$meta:meta] )* $name:ident, $( $args:tt )* ) => { ... }; }
Expand description
Defines print
macro that defines a print macro that uses the specified writer.
The first argument specifies the generated macro name.
The writer itself is specified by the rest arguments with the define_writer
macros.
See also define_println
and define_try_print
macros.
Examples
let mut string = String::new();
custom_print::define_print!(cprint, fmt, |value: &str| string += value);
assert_eq!(cprint!("value"), ());
assert_eq!(string, "value");