Trait wasmtime_wasi_http::bindings::http::types::HostOutgoingRequest
source · pub trait HostOutgoingRequest {
// Required methods
fn new(
&mut self,
headers: Resource<Headers>,
) -> Result<Resource<OutgoingRequest>>;
fn body(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Result<Resource<OutgoingBody>, ()>>;
fn method(&mut self, self_: Resource<OutgoingRequest>) -> Result<Method>;
fn set_method(
&mut self,
self_: Resource<OutgoingRequest>,
method: Method,
) -> Result<Result<(), ()>>;
fn path_with_query(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Option<String>>;
fn set_path_with_query(
&mut self,
self_: Resource<OutgoingRequest>,
path_with_query: Option<String>,
) -> Result<Result<(), ()>>;
fn scheme(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Option<Scheme>>;
fn set_scheme(
&mut self,
self_: Resource<OutgoingRequest>,
scheme: Option<Scheme>,
) -> Result<Result<(), ()>>;
fn authority(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Option<String>>;
fn set_authority(
&mut self,
self_: Resource<OutgoingRequest>,
authority: Option<String>,
) -> Result<Result<(), ()>>;
fn headers(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Resource<Headers>>;
fn drop(&mut self, rep: Resource<OutgoingRequest>) -> Result<()>;
}
Required Methods§
sourcefn new(
&mut self,
headers: Resource<Headers>,
) -> Result<Resource<OutgoingRequest>>
fn new( &mut self, headers: Resource<Headers>, ) -> Result<Resource<OutgoingRequest>>
Construct a new outgoing-request
with a default method
of GET
, and
none
values for path-with-query
, scheme
, and authority
.
headers
is the HTTP Headers for the Request.
It is possible to construct, or manipulate with the accessor functions
below, an outgoing-request
with an invalid combination of scheme
and authority
, or headers
which are not permitted to be sent.
It is the obligation of the outgoing-handler.handle
implementation
to reject invalid constructions of outgoing-request
.
sourcefn body(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Result<Resource<OutgoingBody>, ()>>
fn body( &mut self, self_: Resource<OutgoingRequest>, ) -> Result<Result<Resource<OutgoingBody>, ()>>
Returns the resource corresponding to the outgoing Body for this Request.
Returns success on the first call: the outgoing-body
resource for
this outgoing-request
can be retrieved at most once. Subsequent
calls will return error.
sourcefn method(&mut self, self_: Resource<OutgoingRequest>) -> Result<Method>
fn method(&mut self, self_: Resource<OutgoingRequest>) -> Result<Method>
Get the Method for the Request.
sourcefn set_method(
&mut self,
self_: Resource<OutgoingRequest>,
method: Method,
) -> Result<Result<(), ()>>
fn set_method( &mut self, self_: Resource<OutgoingRequest>, method: Method, ) -> Result<Result<(), ()>>
Set the Method for the Request. Fails if the string present in a
method.other
argument is not a syntactically valid method.
sourcefn path_with_query(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Option<String>>
fn path_with_query( &mut self, self_: Resource<OutgoingRequest>, ) -> Result<Option<String>>
Get the combination of the HTTP Path and Query for the Request.
When none
, this represents an empty Path and empty Query.
sourcefn set_path_with_query(
&mut self,
self_: Resource<OutgoingRequest>,
path_with_query: Option<String>,
) -> Result<Result<(), ()>>
fn set_path_with_query( &mut self, self_: Resource<OutgoingRequest>, path_with_query: Option<String>, ) -> Result<Result<(), ()>>
Set the combination of the HTTP Path and Query for the Request.
When none
, this represents an empty Path and empty Query. Fails is the
string given is not a syntactically valid path and query uri component.
sourcefn scheme(&mut self, self_: Resource<OutgoingRequest>) -> Result<Option<Scheme>>
fn scheme(&mut self, self_: Resource<OutgoingRequest>) -> Result<Option<Scheme>>
Get the HTTP Related Scheme for the Request. When none
, the
implementation may choose an appropriate default scheme.
sourcefn set_scheme(
&mut self,
self_: Resource<OutgoingRequest>,
scheme: Option<Scheme>,
) -> Result<Result<(), ()>>
fn set_scheme( &mut self, self_: Resource<OutgoingRequest>, scheme: Option<Scheme>, ) -> Result<Result<(), ()>>
Set the HTTP Related Scheme for the Request. When none
, the
implementation may choose an appropriate default scheme. Fails if the
string given is not a syntactically valid uri scheme.
Get the authority of the Request’s target URI. A value of none
may be used
with Related Schemes which do not require an authority. The HTTP and
HTTPS schemes always require an authority.
Set the authority of the Request’s target URI. A value of none
may be used
with Related Schemes which do not require an authority. The HTTP and
HTTPS schemes always require an authority. Fails if the string given is
not a syntactically valid URI authority.
sourcefn headers(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Resource<Headers>>
fn headers( &mut self, self_: Resource<OutgoingRequest>, ) -> 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
.
fn drop(&mut self, rep: Resource<OutgoingRequest>) -> Result<()>
Implementations on Foreign Types§
source§impl<_T: HostOutgoingRequest + ?Sized + Send> HostOutgoingRequest for &mut _T
impl<_T: HostOutgoingRequest + ?Sized + Send> HostOutgoingRequest for &mut _T
source§fn new(
&mut self,
headers: Resource<Headers>,
) -> Result<Resource<OutgoingRequest>>
fn new( &mut self, headers: Resource<Headers>, ) -> Result<Resource<OutgoingRequest>>
Construct a new outgoing-request
with a default method
of GET
, and
none
values for path-with-query
, scheme
, and authority
.
headers
is the HTTP Headers for the Request.
It is possible to construct, or manipulate with the accessor functions
below, an outgoing-request
with an invalid combination of scheme
and authority
, or headers
which are not permitted to be sent.
It is the obligation of the outgoing-handler.handle
implementation
to reject invalid constructions of outgoing-request
.
source§fn body(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Result<Resource<OutgoingBody>, ()>>
fn body( &mut self, self_: Resource<OutgoingRequest>, ) -> Result<Result<Resource<OutgoingBody>, ()>>
Returns the resource corresponding to the outgoing Body for this Request.
Returns success on the first call: the outgoing-body
resource for
this outgoing-request
can be retrieved at most once. Subsequent
calls will return error.
source§fn method(&mut self, self_: Resource<OutgoingRequest>) -> Result<Method>
fn method(&mut self, self_: Resource<OutgoingRequest>) -> Result<Method>
Get the Method for the Request.
source§fn set_method(
&mut self,
self_: Resource<OutgoingRequest>,
method: Method,
) -> Result<Result<(), ()>>
fn set_method( &mut self, self_: Resource<OutgoingRequest>, method: Method, ) -> Result<Result<(), ()>>
Set the Method for the Request. Fails if the string present in a
method.other
argument is not a syntactically valid method.
source§fn path_with_query(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Option<String>>
fn path_with_query( &mut self, self_: Resource<OutgoingRequest>, ) -> Result<Option<String>>
Get the combination of the HTTP Path and Query for the Request.
When none
, this represents an empty Path and empty Query.
source§fn set_path_with_query(
&mut self,
self_: Resource<OutgoingRequest>,
path_with_query: Option<String>,
) -> Result<Result<(), ()>>
fn set_path_with_query( &mut self, self_: Resource<OutgoingRequest>, path_with_query: Option<String>, ) -> Result<Result<(), ()>>
Set the combination of the HTTP Path and Query for the Request.
When none
, this represents an empty Path and empty Query. Fails is the
string given is not a syntactically valid path and query uri component.
source§fn scheme(&mut self, self_: Resource<OutgoingRequest>) -> Result<Option<Scheme>>
fn scheme(&mut self, self_: Resource<OutgoingRequest>) -> Result<Option<Scheme>>
Get the HTTP Related Scheme for the Request. When none
, the
implementation may choose an appropriate default scheme.
source§fn set_scheme(
&mut self,
self_: Resource<OutgoingRequest>,
scheme: Option<Scheme>,
) -> Result<Result<(), ()>>
fn set_scheme( &mut self, self_: Resource<OutgoingRequest>, scheme: Option<Scheme>, ) -> Result<Result<(), ()>>
Set the HTTP Related Scheme for the Request. When none
, the
implementation may choose an appropriate default scheme. Fails if the
string given is not a syntactically valid uri scheme.
Get the authority of the Request’s target URI. A value of none
may be used
with Related Schemes which do not require an authority. The HTTP and
HTTPS schemes always require an authority.
Set the authority of the Request’s target URI. A value of none
may be used
with Related Schemes which do not require an authority. The HTTP and
HTTPS schemes always require an authority. Fails if the string given is
not a syntactically valid URI authority.
source§fn headers(
&mut self,
self_: Resource<OutgoingRequest>,
) -> Result<Resource<Headers>>
fn headers( &mut self, self_: Resource<OutgoingRequest>, ) -> 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
.