pub trait HostOutgoingBody: Sized + Send {
// Required methods
fn write(
&mut self,
self_: Resource<OutgoingBody>,
) -> Result<Result<Resource<OutputStream>, ()>>;
fn finish(
&mut self,
this: Resource<OutgoingBody>,
trailers: Option<Resource<Trailers>>,
) -> Result<(), HttpError>;
fn drop(&mut self, rep: Resource<OutgoingBody>) -> Result<()>;
}
Required Methods§
Sourcefn write(
&mut self,
self_: Resource<OutgoingBody>,
) -> Result<Result<Resource<OutputStream>, ()>>
fn write( &mut self, self_: Resource<OutgoingBody>, ) -> Result<Result<Resource<OutputStream>, ()>>
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.
Sourcefn finish(
&mut self,
this: Resource<OutgoingBody>,
trailers: Option<Resource<Trailers>>,
) -> Result<(), HttpError>
fn finish( &mut self, this: Resource<OutgoingBody>, trailers: Option<Resource<Trailers>>, ) -> 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.
fn drop(&mut self, rep: Resource<OutgoingBody>) -> Result<()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<_T: HostOutgoingBody + ?Sized + Send> HostOutgoingBody for &mut _T
impl<_T: HostOutgoingBody + ?Sized + Send> HostOutgoingBody for &mut _T
Source§fn write(
&mut self,
self_: Resource<OutgoingBody>,
) -> Result<Result<Resource<OutputStream>, ()>>
fn write( &mut self, self_: Resource<OutgoingBody>, ) -> Result<Result<Resource<OutputStream>, ()>>
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<OutgoingBody>,
trailers: Option<Resource<Trailers>>,
) -> Result<(), HttpError>
fn finish( &mut self, this: Resource<OutgoingBody>, trailers: Option<Resource<Trailers>>, ) -> 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.