Skip to main content

write_frame

Function write_frame 

Source
pub fn write_frame<W: Write>(writer: &mut W, message: &str) -> Result<usize>
Examples found in repository?
examples/demo.rs (line 6)
3fn main() -> IOResult<()> {
4    let mut stdout = io::stdout();
5    let stdin = io::stdin();
6    frame_protocol::write_frame(&mut stdout, "Hello World")?;
7    stdout.flush().unwrap();
8
9    let mut reader = frame_protocol::FrameReader::new(stdin);
10    let input = reader.next().unwrap()?;
11
12    frame_protocol::write_frame(&mut stdout, &format!("recieved: {input}"))?;
13
14    Ok(())
15}