Function ferris_says::say [−][src]
pub fn say<W>(input: &[u8], max_width: usize, writer: &mut W) -> Result<()> where
W: Write,
Expand description
Print out Ferris saying something.
input
is a slice of bytes that you want to be written out to somewhere
max_width
is the maximum width of a line of text before it is wrapped
writer
is anywhere that can be written to using the Writer trait like
STDOUT or STDERR
Example
The following bit of code will write the byte string to STDOUT
use ferris_says::*; use std::io::{ stdout, BufWriter }; let stdout = stdout(); let out = b"Hello fellow Rustaceans!"; let width = 24; let mut writer = BufWriter::new(stdout.lock()); say(out, width, &mut writer).unwrap();
This will print out:
__________________________
< Hello fellow Rustaceans! >
--------------------------
\
\
_~^~^~_
\) / o o \ (/
'_ - _'
/ '-----' \