pub trait HostIncomingBody {
    // Required methods
    fn stream(
        &mut self,
        self_: Resource<HostIncomingBody>,
    ) -> Result<Result<Resource<Box<dyn HostInputStream>>, ()>, Error>;
    fn finish(
        &mut self,
        this: Resource<HostIncomingBody>,
    ) -> Result<Resource<HostFutureTrailers>, Error>;
    fn drop(&mut self, rep: Resource<HostIncomingBody>) -> Result<(), Error>;
}

Required Methods§

source

fn stream( &mut self, self_: Resource<HostIncomingBody>, ) -> Result<Result<Resource<Box<dyn HostInputStream>>, ()>, Error>

Returns the contents of the body, as a stream of bytes.

Returns success on first call: the stream representing the contents can be retrieved at most once. Subsequent calls will return error.

The returned input-stream resource is a child: it must be dropped before the parent incoming-body is dropped, or consumed by incoming-body.finish.

This invariant ensures that the implementation can determine whether the user is consuming the contents of the body, waiting on the future-trailers to be ready, or neither. This allows for network backpressure is to be applied when the user is consuming the body, and for that backpressure to not inhibit delivery of the trailers if the user does not read the entire body.

source

fn finish( &mut self, this: Resource<HostIncomingBody>, ) -> Result<Resource<HostFutureTrailers>, Error>

Takes ownership of incoming-body, and returns a future-trailers. This function will trap if the input-stream child is still alive.

source

fn drop(&mut self, rep: Resource<HostIncomingBody>) -> Result<(), Error>

Implementations on Foreign Types§

source§

impl<_T> HostIncomingBody for &mut _T
where _T: HostIncomingBody + Send + ?Sized,

source§

fn stream( &mut self, self_: Resource<HostIncomingBody>, ) -> Result<Result<Resource<Box<dyn HostInputStream>>, ()>, Error>

Returns the contents of the body, as a stream of bytes.

Returns success on first call: the stream representing the contents can be retrieved at most once. Subsequent calls will return error.

The returned input-stream resource is a child: it must be dropped before the parent incoming-body is dropped, or consumed by incoming-body.finish.

This invariant ensures that the implementation can determine whether the user is consuming the contents of the body, waiting on the future-trailers to be ready, or neither. This allows for network backpressure is to be applied when the user is consuming the body, and for that backpressure to not inhibit delivery of the trailers if the user does not read the entire body.

source§

fn finish( &mut self, this: Resource<HostIncomingBody>, ) -> Result<Resource<HostFutureTrailers>, Error>

Takes ownership of incoming-body, and returns a future-trailers. This function will trap if the input-stream child is still alive.

source§

fn drop(&mut self, rep: Resource<HostIncomingBody>) -> Result<(), Error>

Implementors§