This commit is contained in:
Carl Lerche
2017-03-10 13:02:04 -08:00
parent 1fe3a57338
commit e2871d92fa
12 changed files with 559 additions and 38 deletions

View File

@@ -1,5 +1,5 @@
use frame::Head;
use bytes::Bytes;
use frame::{Head, Error};
use bytes::{Bytes, BytesMut, BufMut};
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Unknown {
@@ -14,4 +14,14 @@ impl Unknown {
payload: payload,
}
}
pub fn encode_len(&self) -> usize {
self.head.encode_len() + self.payload.len()
}
pub fn encode(&self, dst: &mut BytesMut) -> Result<(), Error> {
try!(self.head.encode(self.payload.len(), dst));
dst.put(&self.payload);
Ok(())
}
}