pub trait HostOutgoingResponse {
// Required methods
fn new(
&mut self,
headers: Resource<Headers>,
) -> Result<Resource<OutgoingResponse>>;
fn status_code(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<StatusCode>;
fn set_status_code(
&mut self,
self_: Resource<OutgoingResponse>,
status_code: StatusCode,
) -> Result<Result<(), ()>>;
fn headers(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<Resource<Headers>>;
fn body(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<Result<Resource<OutgoingBody>, ()>>;
fn drop(&mut self, rep: Resource<OutgoingResponse>) -> Result<()>;
}Required Methods§
Sourcefn new(
&mut self,
headers: Resource<Headers>,
) -> Result<Resource<OutgoingResponse>>
fn new( &mut self, headers: Resource<Headers>, ) -> Result<Resource<OutgoingResponse>>
Construct an outgoing-response, with a default status-code of 200.
If a different status-code is needed, it must be set via the
set-status-code method.
headersis the HTTP Headers for the Response.
Sourcefn status_code(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<StatusCode>
fn status_code( &mut self, self_: Resource<OutgoingResponse>, ) -> Result<StatusCode>
Get the HTTP Status Code for the Response.
Sourcefn set_status_code(
&mut self,
self_: Resource<OutgoingResponse>,
status_code: StatusCode,
) -> Result<Result<(), ()>>
fn set_status_code( &mut self, self_: Resource<OutgoingResponse>, status_code: StatusCode, ) -> Result<Result<(), ()>>
Set the HTTP Status Code for the Response. Fails if the status-code given is not a valid http status code.
Sourcefn headers(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<Resource<Headers>>
fn headers( &mut self, self_: Resource<OutgoingResponse>, ) -> Result<Resource<Headers>>
Get the headers associated with the Request.
The returned headers resource is immutable: set, append, and
delete operations will fail with header-error.immutable.
This headers resource is a child: it must be dropped before the parent
outgoing-request is dropped, or its ownership is transferred to
another component by e.g. outgoing-handler.handle.
Sourcefn body(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<Result<Resource<OutgoingBody>, ()>>
fn body( &mut self, self_: Resource<OutgoingResponse>, ) -> Result<Result<Resource<OutgoingBody>, ()>>
Returns the resource corresponding to the outgoing Body for this Response.
Returns success on the first call: the outgoing-body resource for
this outgoing-response can be retrieved at most once. Subsequent
calls will return error.
fn drop(&mut self, rep: Resource<OutgoingResponse>) -> Result<()>
Implementations on Foreign Types§
Source§impl<_T: HostOutgoingResponse + ?Sized> HostOutgoingResponse for &mut _T
impl<_T: HostOutgoingResponse + ?Sized> HostOutgoingResponse for &mut _T
Source§fn new(
&mut self,
headers: Resource<Headers>,
) -> Result<Resource<OutgoingResponse>>
Available on crate feature component-model-async only.
fn new( &mut self, headers: Resource<Headers>, ) -> Result<Resource<OutgoingResponse>>
component-model-async only.Construct an outgoing-response, with a default status-code of 200.
If a different status-code is needed, it must be set via the
set-status-code method.
headersis the HTTP Headers for the Response.
Source§fn status_code(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<StatusCode>
Available on crate feature component-model-async only.
fn status_code( &mut self, self_: Resource<OutgoingResponse>, ) -> Result<StatusCode>
component-model-async only.Get the HTTP Status Code for the Response.
Source§fn set_status_code(
&mut self,
self_: Resource<OutgoingResponse>,
status_code: StatusCode,
) -> Result<Result<(), ()>>
Available on crate feature component-model-async only.
fn set_status_code( &mut self, self_: Resource<OutgoingResponse>, status_code: StatusCode, ) -> Result<Result<(), ()>>
component-model-async only.Set the HTTP Status Code for the Response. Fails if the status-code given is not a valid http status code.
Source§fn headers(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<Resource<Headers>>
Available on crate feature component-model-async only.
fn headers( &mut self, self_: Resource<OutgoingResponse>, ) -> Result<Resource<Headers>>
component-model-async only.Get the headers associated with the Request.
The returned headers resource is immutable: set, append, and
delete operations will fail with header-error.immutable.
This headers resource is a child: it must be dropped before the parent
outgoing-request is dropped, or its ownership is transferred to
another component by e.g. outgoing-handler.handle.
Source§fn body(
&mut self,
self_: Resource<OutgoingResponse>,
) -> Result<Result<Resource<OutgoingBody>, ()>>
Available on crate feature component-model-async only.
fn body( &mut self, self_: Resource<OutgoingResponse>, ) -> Result<Result<Resource<OutgoingBody>, ()>>
component-model-async only.Returns the resource corresponding to the outgoing Body for this Response.
Returns success on the first call: the outgoing-body resource for
this outgoing-response can be retrieved at most once. Subsequent
calls will return error.