pub trait HostResponseOutparam: Send + Send {
// Required methods
fn send_informational(
&mut self,
self_: Resource<ResponseOutparam>,
status: u16,
headers: Resource<Headers>,
) -> Result<(), HttpError>;
fn set(
&mut self,
param: Resource<ResponseOutparam>,
response: Result<Resource<OutgoingResponse>, ErrorCode>,
) -> Result<()>;
fn drop(&mut self, rep: Resource<ResponseOutparam>) -> Result<()>;
}
Required Methods§
Sourcefn send_informational(
&mut self,
self_: Resource<ResponseOutparam>,
status: u16,
headers: Resource<Headers>,
) -> Result<(), HttpError>
fn send_informational( &mut self, self_: Resource<ResponseOutparam>, status: u16, headers: Resource<Headers>, ) -> Result<(), HttpError>
Send an HTTP 1xx response.
Unlike response-outparam.set
, this does not consume the
response-outparam
, allowing the guest to send an arbitrary number of
informational responses before sending the final response using
response-outparam.set
.
This will return an HTTP-protocol-error
if status
is not in the
range [100-199], or an internal-error
if the implementation does not
support informational responses.
Sourcefn set(
&mut self,
param: Resource<ResponseOutparam>,
response: Result<Resource<OutgoingResponse>, ErrorCode>,
) -> Result<()>
fn set( &mut self, param: Resource<ResponseOutparam>, response: Result<Resource<OutgoingResponse>, ErrorCode>, ) -> Result<()>
Set the value of the response-outparam
to either send a response,
or indicate an error.
This method consumes the response-outparam
to ensure that it is
called at most once. If it is never called, the implementation
will respond with an error.
The user may provide an error
to response
to allow the
implementation determine how to respond with an HTTP error response.
fn drop(&mut self, rep: Resource<ResponseOutparam>) -> Result<()>
Implementations on Foreign Types§
Source§impl<_T: HostResponseOutparam + ?Sized + Send> HostResponseOutparam for &mut _T
impl<_T: HostResponseOutparam + ?Sized + Send> HostResponseOutparam for &mut _T
Source§fn send_informational(
&mut self,
self_: Resource<ResponseOutparam>,
status: u16,
headers: Resource<Headers>,
) -> Result<(), HttpError>
fn send_informational( &mut self, self_: Resource<ResponseOutparam>, status: u16, headers: Resource<Headers>, ) -> Result<(), HttpError>
Send an HTTP 1xx response.
Unlike response-outparam.set
, this does not consume the
response-outparam
, allowing the guest to send an arbitrary number of
informational responses before sending the final response using
response-outparam.set
.
This will return an HTTP-protocol-error
if status
is not in the
range [100-199], or an internal-error
if the implementation does not
support informational responses.
Source§fn set(
&mut self,
param: Resource<ResponseOutparam>,
response: Result<Resource<OutgoingResponse>, ErrorCode>,
) -> Result<()>
fn set( &mut self, param: Resource<ResponseOutparam>, response: Result<Resource<OutgoingResponse>, ErrorCode>, ) -> Result<()>
Set the value of the response-outparam
to either send a response,
or indicate an error.
This method consumes the response-outparam
to ensure that it is
called at most once. If it is never called, the implementation
will respond with an error.
The user may provide an error
to response
to allow the
implementation determine how to respond with an HTTP error response.