Macro custom_print::define_try_println [−][src]
macro_rules! define_try_println { ( $name:ident, $($args:tt)* ) => { ... }; }
Expand description
Defines try_println macro that defines
a fallible println 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_try_println!(try_println, fmt, |value: &str| string += value); assert_eq!(try_println!("value"), Ok(())); assert_eq!(string, "value\n");