Process response

This commit is contained in:
Carl Lerche
2017-06-27 01:34:37 -07:00
parent 7897b770e9
commit 1f85d54cff
8 changed files with 112 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
use frame::{util, Head, Error, StreamId, Kind};
use frame::{util, Frame, Head, Error, StreamId, Kind};
use bytes::{BufMut, Bytes};
#[derive(Debug)]
@@ -35,10 +35,18 @@ impl Data {
})
}
pub fn stream_id(&self) -> StreamId {
self.stream_id
}
pub fn len(&self) -> usize {
self.data.len()
}
pub fn is_end_stream(&self) -> bool {
self.flags.is_end_stream()
}
pub fn encode<T: BufMut>(&self, dst: &mut T) {
self.head().encode(self.len(), dst);
dst.put(&self.data);
@@ -53,6 +61,13 @@ impl Data {
}
}
impl From<Data> for Frame {
fn from(src: Data) -> Frame {
Frame::Data(src)
}
}
// ===== impl DataFlag =====
impl DataFlag {
pub fn load(bits: u8) -> DataFlag {