author | unc0rr |
Sat, 07 Jan 2017 21:34:00 +0300 | |
changeset 12132 | 1525923cd7e3 |
parent 12131 | a4d22f197bd2 |
child 12133 | 81df2e1f9ae9 |
permissions | -rw-r--r-- |
use netbuf; use std::io::Read; use std::io::Result; mod messages; pub struct FrameDecoder { buf: netbuf::Buf, } impl FrameDecoder { pub fn new() -> FrameDecoder { FrameDecoder { buf: netbuf::Buf::new() } } pub fn read_from<R: Read>(&mut self, stream: &mut R) -> Result<usize> { self.buf.read_from(stream) } pub fn extract_messages(&mut self) -> &[u8] { &self.buf[..] } }