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§

source

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.

  • headers is the HTTP Headers for the Response.
source

fn status_code( &mut self, self_: Resource<OutgoingResponse>, ) -> Result<StatusCode>

Get the HTTP Status Code for the Response.

source

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.

source

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.

source

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.

source

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

Implementations on Foreign Types§

source§

impl<_T: HostOutgoingResponse + ?Sized + Send> HostOutgoingResponse for &mut _T

source§

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.

  • headers is the HTTP Headers for the Response.
source§

fn status_code( &mut self, self_: Resource<OutgoingResponse>, ) -> Result<StatusCode>

Get the HTTP Status Code for the Response.

source§

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.

source§

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.

source§

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.

source§

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

Implementors§