pub trait HostOutgoingBody {
    // Required methods
    fn write(
        &mut self,
        self_: Resource<HostOutgoingBody>,
    ) -> Result<Result<Resource<Box<dyn HostOutputStream>>, ()>, Error>;
    fn finish(
        &mut self,
        this: Resource<HostOutgoingBody>,
        trailers: Option<Resource<HostFields>>,
    ) -> Result<(), HttpError>;
    fn drop(&mut self, rep: Resource<HostOutgoingBody>) -> Result<(), Error>;
}

Required Methods§

source

fn write( &mut self, self_: Resource<HostOutgoingBody>, ) -> Result<Result<Resource<Box<dyn HostOutputStream>>, ()>, Error>

Returns a stream for writing the body contents.

The returned output-stream is a child resource: it must be dropped before the parent outgoing-body resource is dropped (or finished), otherwise the outgoing-body drop or finish will trap.

Returns success on the first call: the output-stream resource for this outgoing-body may be retrieved at most once. Subsequent calls will return error.

source

fn finish( &mut self, this: Resource<HostOutgoingBody>, trailers: Option<Resource<HostFields>>, ) -> Result<(), HttpError>

Finalize an outgoing body, optionally providing trailers. This must be called to signal that the response is complete. If the outgoing-body is dropped without calling outgoing-body.finalize, the implementation should treat the body as corrupted.

Fails if the body’s outgoing-request or outgoing-response was constructed with a Content-Length header, and the contents written to the body (via write) does not match the value given in the Content-Length.

source

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

Implementations on Foreign Types§

source§

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

source§

fn write( &mut self, self_: Resource<HostOutgoingBody>, ) -> Result<Result<Resource<Box<dyn HostOutputStream>>, ()>, Error>

Returns a stream for writing the body contents.

The returned output-stream is a child resource: it must be dropped before the parent outgoing-body resource is dropped (or finished), otherwise the outgoing-body drop or finish will trap.

Returns success on the first call: the output-stream resource for this outgoing-body may be retrieved at most once. Subsequent calls will return error.

source§

fn finish( &mut self, this: Resource<HostOutgoingBody>, trailers: Option<Resource<HostFields>>, ) -> Result<(), HttpError>

Finalize an outgoing body, optionally providing trailers. This must be called to signal that the response is complete. If the outgoing-body is dropped without calling outgoing-body.finalize, the implementation should treat the body as corrupted.

Fails if the body’s outgoing-request or outgoing-response was constructed with a Content-Length header, and the contents written to the body (via write) does not match the value given in the Content-Length.

source§

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

Implementors§