implement h2::server::Stream::send_reset(Reason) and Body::is_empty() (#22)
This commit is contained in:
committed by
Carl Lerche
parent
e8f757457b
commit
f839443ece
11
src/lib.rs
11
src/lib.rs
@@ -55,6 +55,17 @@ pub struct Body<B: IntoBuf> {
|
||||
|
||||
// ===== impl Body =====
|
||||
|
||||
impl<B: IntoBuf> Body<B> {
|
||||
pub fn is_empty(&self) -> bool {
|
||||
// If the recv side is closed and the receive queue is empty, the body is empty.
|
||||
self.inner.body_is_empty()
|
||||
}
|
||||
|
||||
pub fn release_capacity(&mut self, sz: usize) -> Result<(), ConnectionError> {
|
||||
self.inner.release_capacity(sz as proto::WindowSize)
|
||||
}
|
||||
}
|
||||
|
||||
impl<B: IntoBuf> futures::Stream for Body<B> {
|
||||
type Item = Bytes;
|
||||
type Error = ConnectionError;
|
||||
|
||||
Reference in New Issue
Block a user