author | unc0rr |
Tue, 03 Jan 2017 00:19:47 +0300 | |
changeset 12134 | 07972a8c2433 |
permissions | -rw-r--r-- |
use netbuf; use std::io::Read; use std::io::Result; 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[..] } }