Macro fomat_macros::wite
[−]
[src]
macro_rules! wite { (@one $w:ident, ($e:expr)) => { ... }; (@one $w:ident, [$e:expr]) => { ... }; (@one $w:ident, {$e:tt : $($fmt:tt)*}) => { ... }; (@one $w:ident, {$($arg:tt)*}) => { ... }; (@one $w:ident, $string:tt) => { ... }; (@stringify-dense) => { ... }; (@stringify-dense $($tt:tt)+) => { ... }; (@expr.. $w:ident {$($before:tt)*} ($($e:tt)*) {$($block:tt)*} $($rest:tt)* ) => { ... }; (@expr.. $w:ident {$($before:tt)*} ($($expr:tt)*) $tt:tt $($rest:tt)* ) => { ... }; (@expr $w:ident {$($before:tt)*} ($($expr:tt)*) $tt:tt $($rest:tt)* ) => { ... }; (@rec $w:ident, for $p:pat in ($e:expr) { $($body:tt)* } sep { $($sep:tt)* } $($rest:tt)* ) => { ... }; (@rec $w:ident, for $p:pat in ($e:expr) { $($body:tt)* } separated { $($sep:tt)* } $($rest:tt)* ) => { ... }; (@rec $w:ident, for $p:pat in ($e:expr) { $($body:tt)* } $($rest:tt)*) => { ... }; (@rec $w:ident, for $p:pat in $($tt:tt)* ) => { ... }; (@rec $w:ident, match ($e:expr) { $( $($p:pat)|+ $(if $g:expr)* => { $($body:tt)* } )* } $($rest:tt)* ) => { ... }; (@rec $w:ident, match $($tt:tt)* ) => { ... }; (@rec $w:ident, if let $p:pat = ($e:expr) { $($then:tt)* } else { $($els:tt)* } $($rest:tt)* ) => { ... }; (@rec $w:ident, if let $p:pat = ($e:expr) { $($then:tt)* } else if $($rest:tt)* ) => { ... }; (@rec $w:ident, if let $p:pat = ($e:expr) { $($then:tt)* } $($rest:tt)* ) => { ... }; (@rec $w:ident, if let $p:pat = $($tt:tt)* ) => { ... }; (@rec $w:ident, if ($cond:expr) { $($then:tt)* } else { $($els:tt)* } $($rest:tt)* ) => { ... }; (@rec $w:ident, if ($cont:expr) { $($then:tt)* } else if $($rest:tt)* ) => { ... }; (@rec $w:ident, if ($cond:expr) { $($then:tt)* } $($rest:tt)* ) => { ... }; (@rec $w:ident, if $($tt:tt)* ) => { ... }; (@rec $w:ident, (= $e:expr) $($rest:tt)*) => { ... }; (@rec $w:ident, [= $e:expr] $($rest:tt)*) => { ... }; (@rec $w:ident, {= $e:tt : $($fmt:tt)*} $($rest:tt)*) => { ... }; (@rec $w:ident, $part:tt $($rest:tt)*) => { ... }; (@rec $w:ident, ) => { ... }; (@ifelseerror) => { ... }; ($writer:expr, $($part:tt)*) => { ... }; }
Writes to a specified writer. Analogous to write!
.
See the crate root for general help on the syntax.
The first argument should be something that implements either io::Write
or fmt::Write
. This expression will be evaluated once.
The list of things to write should be written after the first comma, without any further delimiters.
Return value
This macro returns io::Result<()>
or fmt::Result
,
just as write!
from std
.
Examples
use ::std::io::Write; use ::std::io::BufWriter; let mut v = vec![]; let world = "World"; wite!(v, "Hello, "(world)"!").unwrap(); wite!(BufWriter::new(&mut v), " "(2+2)).unwrap(); assert_eq!(v, "Hello, World! 4".as_bytes());