What are these arguments to Rust's std::fmt::write? -



What are these arguments to Rust's std::fmt::write? -

i'm trying create sure understand examples on http://chrismorgan.info/blog/rust-fizzbuzz.html, , 1 thing stuck on has nil fizzbuzz, instead arguments write().

consider code below: in line fizz => f.write(b"fizz"), 'b' , did come from?

use std::fmt; enum fizzbuzzitem { fizz, buzz, fizzbuzz, number(int), } impl fmt::show fizzbuzzitem { fn fmt(&self, f: &mut fmt::formatter) -> fmt::result { match *self { fizz => f.write(b"fizz"), buzz => f.write(b"buzz"), fizzbuzz => f.write(b"fizzbuzz"), number(num) => write!(f, "{}", num), } } }

b"…" byte string literal. "…" has type &'static str, has type &'static [u8].

rust

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -