Trait wasmcloud_runtime::capability::http::types::HostOutgoingRequest
source · pub trait HostOutgoingRequest {
// Required methods
fn new(
&mut self,
headers: Resource<HostFields>,
) -> Result<Resource<HostOutgoingRequest>, Error>;
fn body(
&mut self,
self_: Resource<HostOutgoingRequest>,
) -> Result<Result<Resource<HostOutgoingBody>, ()>, Error>;
fn method(
&mut self,
self_: Resource<HostOutgoingRequest>,
) -> Result<Method, Error>;
fn set_method(
&mut self,
self_: Resource<HostOutgoingRequest>,
method: Method,
) -> Result<Result<(), ()>, Error>;
fn path_with_query(
&mut self,
self_: Resource<HostOutgoingRequest>,
) -> Result<Option<String>, Error>;
fn set_path_with_query(
&mut self,
self_: Resource<HostOutgoingRequest>,
path_with_query: Option<String>,
) -> Result<Result<(), ()>, Error>;
fn scheme(
&mut self,
self_: Resource<HostOutgoingRequest>,
) -> Result<Option<Scheme>, Error>;
fn set_scheme(
&mut self,
self_: Resource<HostOutgoingRequest>,
scheme: Option<Scheme>,
) -> Result<Result<(), ()>, Error>;
fn authority(
&mut self,
self_: Resource<HostOutgoingRequest>,
) -> Result<Option<String>, Error>;
fn set_authority(
&mut self,
self_: Resource<HostOutgoingRequest>,
authority: Option<String>,
) -> Result<Result<(), ()>, Error>;
fn headers(
&mut self,
self_: Resource<HostOutgoingRequest>,
) -> Result<Resource<HostFields>, Error>;
fn drop(&mut self, rep: Resource<HostOutgoingRequest>) -> Result<(), Error>;
}
Required Methods§
sourcefn new(
&mut self,
headers: Resource<HostFields>,
) -> Result<Resource<HostOutgoingRequest>, Error>
fn new( &mut self, headers: Resource<HostFields>, ) -> Result<Resource<HostOutgoingRequest>, Error>
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<HostOutgoingRequest>,
) -> Result<Result<Resource<HostOutgoingBody>, ()>, Error>
fn body( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Result<Resource<HostOutgoingBody>, ()>, Error>
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<HostOutgoingRequest>,
) -> Result<Method, Error>
fn method( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Method, Error>
Get the Method for the Request.
sourcefn set_method(
&mut self,
self_: Resource<HostOutgoingRequest>,
method: Method,
) -> Result<Result<(), ()>, Error>
fn set_method( &mut self, self_: Resource<HostOutgoingRequest>, method: Method, ) -> Result<Result<(), ()>, Error>
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<HostOutgoingRequest>,
) -> Result<Option<String>, Error>
fn path_with_query( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Option<String>, Error>
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<HostOutgoingRequest>,
path_with_query: Option<String>,
) -> Result<Result<(), ()>, Error>
fn set_path_with_query( &mut self, self_: Resource<HostOutgoingRequest>, path_with_query: Option<String>, ) -> Result<Result<(), ()>, Error>
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<HostOutgoingRequest>,
) -> Result<Option<Scheme>, Error>
fn scheme( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Option<Scheme>, Error>
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<HostOutgoingRequest>,
scheme: Option<Scheme>,
) -> Result<Result<(), ()>, Error>
fn set_scheme( &mut self, self_: Resource<HostOutgoingRequest>, scheme: Option<Scheme>, ) -> Result<Result<(), ()>, Error>
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<HostOutgoingRequest>,
) -> Result<Resource<HostFields>, Error>
fn headers( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Resource<HostFields>, Error>
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<HostOutgoingRequest>) -> Result<(), Error>
Implementations on Foreign Types§
source§impl<_T> HostOutgoingRequest for &mut _T
impl<_T> HostOutgoingRequest for &mut _T
source§fn new(
&mut self,
headers: Resource<HostFields>,
) -> Result<Resource<HostOutgoingRequest>, Error>
fn new( &mut self, headers: Resource<HostFields>, ) -> Result<Resource<HostOutgoingRequest>, Error>
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<HostOutgoingRequest>,
) -> Result<Result<Resource<HostOutgoingBody>, ()>, Error>
fn body( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Result<Resource<HostOutgoingBody>, ()>, Error>
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<HostOutgoingRequest>,
) -> Result<Method, Error>
fn method( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Method, Error>
Get the Method for the Request.
source§fn set_method(
&mut self,
self_: Resource<HostOutgoingRequest>,
method: Method,
) -> Result<Result<(), ()>, Error>
fn set_method( &mut self, self_: Resource<HostOutgoingRequest>, method: Method, ) -> Result<Result<(), ()>, Error>
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<HostOutgoingRequest>,
) -> Result<Option<String>, Error>
fn path_with_query( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Option<String>, Error>
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<HostOutgoingRequest>,
path_with_query: Option<String>,
) -> Result<Result<(), ()>, Error>
fn set_path_with_query( &mut self, self_: Resource<HostOutgoingRequest>, path_with_query: Option<String>, ) -> Result<Result<(), ()>, Error>
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<HostOutgoingRequest>,
) -> Result<Option<Scheme>, Error>
fn scheme( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Option<Scheme>, Error>
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<HostOutgoingRequest>,
scheme: Option<Scheme>,
) -> Result<Result<(), ()>, Error>
fn set_scheme( &mut self, self_: Resource<HostOutgoingRequest>, scheme: Option<Scheme>, ) -> Result<Result<(), ()>, Error>
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<HostOutgoingRequest>,
) -> Result<Resource<HostFields>, Error>
fn headers( &mut self, self_: Resource<HostOutgoingRequest>, ) -> Result<Resource<HostFields>, Error>
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
.