pub struct WasiHttpCtxView<'a> {
pub hooks: &'a mut dyn WasiHttpHooks,
pub table: &'a mut ResourceTable,
pub ctx: &'a mut WasiHttpCtx,
}Expand description
Basis of implementation of all wasi:http APIs in this crate.
This type provides a temporary view into information such as a WASI
resource table, HTTP context information, and embedder-provided hooks if
so desired. THe fields in this structure are typically stored within the
T of Store<T> and this struct borrows from there. All Host traits
generated by bindgen! are implemented for this type.
Fields§
§hooks: &'a mut dyn WasiHttpHooksMutable reference to the WASI HTTP hooks.
Note that default_hooks or Default::default() can be used if
you don’t want or need to customize this.
table: &'a mut ResourceTableMutable reference to table used to manage resources.
ctx: &'a mut WasiHttpCtxMutable reference to the WASI HTTP context.
Implementations§
Source§impl WasiHttpCtxView<'_>
impl WasiHttpCtxView<'_>
Source§impl WasiHttpCtxView<'_>
impl WasiHttpCtxView<'_>
Sourcepub fn new_response_outparam(
&mut self,
result: Sender<Result<Response<HyperOutgoingBody>, ErrorCode>>,
) -> Result<Resource<HostResponseOutparam>>
Available on crate feature p2 only.
pub fn new_response_outparam( &mut self, result: Sender<Result<Response<HyperOutgoingBody>, ErrorCode>>, ) -> Result<Resource<HostResponseOutparam>>
p2 only.Create a new outgoing response resource.
Sourcepub fn new_response_outparam_from_callback(
&mut self,
callback: impl FnOnce(Result<Response<HyperOutgoingBody>, ErrorCode>) + Send + Sync + 'static,
) -> Result<Resource<HostResponseOutparam>>
Available on crate feature p2 only.
pub fn new_response_outparam_from_callback( &mut self, callback: impl FnOnce(Result<Response<HyperOutgoingBody>, ErrorCode>) + Send + Sync + 'static, ) -> Result<Resource<HostResponseOutparam>>
p2 only.Create a new outgoing response from an FnOnce.
Trait Implementations§
Source§impl Host for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl Host for WasiHttpCtxView<'_>
Available on crate feature
p2 only.Source§fn handle(
&mut self,
request_id: Resource<HostOutgoingRequest>,
options: Option<Resource<RequestOptions>>,
) -> HttpResult<Resource<HostFutureIncomingResponse>>
fn handle( &mut self, request_id: Resource<HostOutgoingRequest>, options: Option<Resource<RequestOptions>>, ) -> HttpResult<Resource<HostFutureIncomingResponse>>
This function is invoked with an outgoing HTTP Request, and it returns
a resource
future-incoming-response which represents an HTTP Response
which may arrive in the future. Read moreSource§impl Host for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl Host for WasiHttpCtxView<'_>
Available on crate feature
p2 only.fn convert_error_code(&mut self, err: HttpError) -> Result<ErrorCode>
fn convert_header_error(&mut self, err: HeaderError) -> Result<HeaderError>
impl Host for WasiHttpCtxView<'_>
Available on crate feature
p3 only.Source§impl Host for WasiHttpCtxView<'_>
Available on crate feature p3 only.
impl Host for WasiHttpCtxView<'_>
Available on crate feature
p3 only.fn convert_error_code( &mut self, error: TrappableError<ErrorCode>, ) -> Result<ErrorCode>
fn convert_header_error( &mut self, error: TrappableError<HeaderError>, ) -> Result<HeaderError>
fn convert_request_options_error( &mut self, error: TrappableError<RequestOptionsError>, ) -> Result<RequestOptionsError>
Source§impl HostFields for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostFields for WasiHttpCtxView<'_>
Available on crate feature
p2 only.Source§fn from_list(
&mut self,
entries: Vec<(String, Vec<u8>)>,
) -> HeaderResult<Resource<FieldMap>>
fn from_list( &mut self, entries: Vec<(String, Vec<u8>)>, ) -> HeaderResult<Resource<FieldMap>>
Construct an HTTP Fields. Read more
fn drop(&mut self, fields: Resource<FieldMap>) -> Result<()>
Source§fn get(
&mut self,
fields: Resource<FieldMap>,
name: String,
) -> Result<Vec<Vec<u8>>>
fn get( &mut self, fields: Resource<FieldMap>, name: String, ) -> Result<Vec<Vec<u8>>>
Get all of the values corresponding to a name. If the name is not present
in this
fields or is syntactically invalid, an empty list is returned.
However, if the name is present but empty, this is represented by a list
with one or more empty field-values present.Source§fn has(&mut self, fields: Resource<FieldMap>, name: String) -> Result<bool>
fn has(&mut self, fields: Resource<FieldMap>, name: String) -> Result<bool>
Returns
true when the name is present in this fields. If the name is
syntactically invalid, false is returned.Source§fn set(
&mut self,
fields: Resource<FieldMap>,
name: String,
values: Vec<Vec<u8>>,
) -> HeaderResult<()>
fn set( &mut self, fields: Resource<FieldMap>, name: String, values: Vec<Vec<u8>>, ) -> HeaderResult<()>
Set all of the values for a name. Clears any existing values for that
name, if they have been set. Read more
Source§fn delete(
&mut self,
fields: Resource<FieldMap>,
name: String,
) -> HeaderResult<()>
fn delete( &mut self, fields: Resource<FieldMap>, name: String, ) -> HeaderResult<()>
Delete all values for a name. Does nothing if no values for the name
exist. Read more
Source§fn append(
&mut self,
fields: Resource<FieldMap>,
name: String,
value: Vec<u8>,
) -> HeaderResult<()>
fn append( &mut self, fields: Resource<FieldMap>, name: String, value: Vec<u8>, ) -> HeaderResult<()>
Append a value for a name. Does not change or delete any existing
values for that name. Read more
Source§impl HostFields for WasiHttpCtxView<'_>
Available on crate feature p3 only.
impl HostFields for WasiHttpCtxView<'_>
Available on crate feature
p3 only.Source§fn from_list(
&mut self,
entries: Vec<(FieldName, FieldValue)>,
) -> Result<Resource<Fields>, TrappableError<HeaderError>>
fn from_list( &mut self, entries: Vec<(FieldName, FieldValue)>, ) -> Result<Resource<Fields>, TrappableError<HeaderError>>
Construct an HTTP Fields. Read more
Source§fn get(
&mut self,
fields: Resource<Fields>,
name: FieldName,
) -> Result<Vec<FieldValue>>
fn get( &mut self, fields: Resource<Fields>, name: FieldName, ) -> Result<Vec<FieldValue>>
Get all of the values corresponding to a name. If the name is not present
in this
fields, an empty list is returned. However, if the name is
present but empty, this is represented by a list with one or more
empty field-values present.Source§fn has(&mut self, fields: Resource<Fields>, name: FieldName) -> Result<bool>
fn has(&mut self, fields: Resource<Fields>, name: FieldName) -> Result<bool>
Returns
true when the name is present in this fields. If the name is
syntactically invalid, false is returned.Source§fn set(
&mut self,
fields: Resource<Fields>,
name: FieldName,
values: Vec<FieldValue>,
) -> Result<(), TrappableError<HeaderError>>
fn set( &mut self, fields: Resource<Fields>, name: FieldName, values: Vec<FieldValue>, ) -> Result<(), TrappableError<HeaderError>>
Set all of the values for a name. Clears any existing values for that
name, if they have been set. Read more
Source§fn delete(
&mut self,
fields: Resource<Fields>,
name: FieldName,
) -> Result<(), TrappableError<HeaderError>>
fn delete( &mut self, fields: Resource<Fields>, name: FieldName, ) -> Result<(), TrappableError<HeaderError>>
Delete all values for a name. Does nothing if no values for the name
exist. Read more
Source§fn get_and_delete(
&mut self,
fields: Resource<Fields>,
name: FieldName,
) -> Result<Vec<FieldValue>, TrappableError<HeaderError>>
fn get_and_delete( &mut self, fields: Resource<Fields>, name: FieldName, ) -> Result<Vec<FieldValue>, TrappableError<HeaderError>>
Delete all values for a name. Does nothing if no values for the name
exist. Read more
Source§fn append(
&mut self,
fields: Resource<Fields>,
name: FieldName,
value: FieldValue,
) -> Result<(), TrappableError<HeaderError>>
fn append( &mut self, fields: Resource<Fields>, name: FieldName, value: FieldValue, ) -> Result<(), TrappableError<HeaderError>>
Append a value for a name. Does not change or delete any existing
values for that name. Read more
Source§fn copy_all(
&mut self,
fields: Resource<Fields>,
) -> Result<Vec<(FieldName, FieldValue)>>
fn copy_all( &mut self, fields: Resource<Fields>, ) -> Result<Vec<(FieldName, FieldValue)>>
Retrieve the full set of names and values in the Fields. Like the
constructor, the list represents each name-value pair. Read more
Source§fn clone(&mut self, fields: Resource<Fields>) -> Result<Resource<Fields>>
fn clone(&mut self, fields: Resource<Fields>) -> Result<Resource<Fields>>
Make a deep copy of the Fields. Equivalent in behavior to calling the
fields constructor on the return value of copy-all. The resulting
fields is mutable.fn drop(&mut self, fields: Resource<Fields>) -> Result<()>
Source§impl HostFutureIncomingResponse for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostFutureIncomingResponse for WasiHttpCtxView<'_>
Available on crate feature
p2 only.fn drop(&mut self, id: Resource<HostFutureIncomingResponse>) -> Result<()>
Source§fn get(
&mut self,
id: Resource<HostFutureIncomingResponse>,
) -> Result<Option<Result<Result<Resource<HostIncomingResponse>, ErrorCode>, ()>>>
fn get( &mut self, id: Resource<HostFutureIncomingResponse>, ) -> Result<Option<Result<Result<Resource<HostIncomingResponse>, ErrorCode>, ()>>>
Returns the incoming HTTP Response, or an error, once one is ready. Read more
Source§fn subscribe(
&mut self,
id: Resource<HostFutureIncomingResponse>,
) -> Result<Resource<DynPollable>>
fn subscribe( &mut self, id: Resource<HostFutureIncomingResponse>, ) -> Result<Resource<DynPollable>>
Returns a pollable which becomes ready when either the Response has
been received, or an error has occurred. When this pollable is ready,
the
get method will return some.Source§impl HostFutureTrailers for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostFutureTrailers for WasiHttpCtxView<'_>
Available on crate feature
p2 only.fn drop(&mut self, id: Resource<HostFutureTrailers>) -> Result<()>
Source§fn subscribe(
&mut self,
index: Resource<HostFutureTrailers>,
) -> Result<Resource<DynPollable>>
fn subscribe( &mut self, index: Resource<HostFutureTrailers>, ) -> Result<Resource<DynPollable>>
Returns a pollable which becomes ready when either the trailers have
been received, or an error has occurred. When this pollable is ready,
the
get method will return some.Source§impl HostIncomingBody for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostIncomingBody for WasiHttpCtxView<'_>
Available on crate feature
p2 only.Source§fn stream(
&mut self,
id: Resource<HostIncomingBody>,
) -> Result<Result<Resource<DynInputStream>, ()>>
fn stream( &mut self, id: Resource<HostIncomingBody>, ) -> Result<Result<Resource<DynInputStream>, ()>>
Returns the contents of the body, as a stream of bytes. Read more
Source§fn finish(
&mut self,
id: Resource<HostIncomingBody>,
) -> Result<Resource<HostFutureTrailers>>
fn finish( &mut self, id: Resource<HostIncomingBody>, ) -> Result<Resource<HostFutureTrailers>>
Takes ownership of
incoming-body, and returns a future-trailers.
This function will trap if the input-stream child is still alive.fn drop(&mut self, id: Resource<HostIncomingBody>) -> Result<()>
Source§impl HostIncomingRequest for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostIncomingRequest for WasiHttpCtxView<'_>
Available on crate feature
p2 only.Source§fn method(&mut self, id: Resource<HostIncomingRequest>) -> Result<Method>
fn method(&mut self, id: Resource<HostIncomingRequest>) -> Result<Method>
Returns the method of the incoming request.
Source§fn path_with_query(
&mut self,
id: Resource<HostIncomingRequest>,
) -> Result<Option<String>>
fn path_with_query( &mut self, id: Resource<HostIncomingRequest>, ) -> Result<Option<String>>
Returns the path with query parameters from the request, as a string.
Source§fn scheme(
&mut self,
id: Resource<HostIncomingRequest>,
) -> Result<Option<Scheme>>
fn scheme( &mut self, id: Resource<HostIncomingRequest>, ) -> Result<Option<Scheme>>
Returns the protocol scheme from the request.
Returns the authority of the Request’s target URI, if present.
Source§fn headers(
&mut self,
id: Resource<HostIncomingRequest>,
) -> Result<Resource<FieldMap>>
fn headers( &mut self, id: Resource<HostIncomingRequest>, ) -> Result<Resource<FieldMap>>
Get the
headers associated with the request. Read moreSource§fn consume(
&mut self,
id: Resource<HostIncomingRequest>,
) -> Result<Result<Resource<HostIncomingBody>, ()>>
fn consume( &mut self, id: Resource<HostIncomingRequest>, ) -> Result<Result<Resource<HostIncomingBody>, ()>>
Gives the
incoming-body associated with this request. Will only
return success at most once, and subsequent calls will return error.fn drop(&mut self, id: Resource<HostIncomingRequest>) -> Result<()>
Source§impl HostIncomingResponse for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostIncomingResponse for WasiHttpCtxView<'_>
Available on crate feature
p2 only.fn drop(&mut self, response: Resource<HostIncomingResponse>) -> Result<()>
Source§fn status(
&mut self,
response: Resource<HostIncomingResponse>,
) -> Result<StatusCode>
fn status( &mut self, response: Resource<HostIncomingResponse>, ) -> Result<StatusCode>
Returns the status code from the incoming response.
Source§fn headers(
&mut self,
response: Resource<HostIncomingResponse>,
) -> Result<Resource<FieldMap>>
fn headers( &mut self, response: Resource<HostIncomingResponse>, ) -> Result<Resource<FieldMap>>
Returns the headers from the incoming response. Read more
Source§fn consume(
&mut self,
response: Resource<HostIncomingResponse>,
) -> Result<Result<Resource<HostIncomingBody>, ()>>
fn consume( &mut self, response: Resource<HostIncomingResponse>, ) -> Result<Result<Resource<HostIncomingBody>, ()>>
Returns the incoming body. May be called at most once. Returns error
if called additional times.
Source§impl HostOutgoingBody for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostOutgoingBody for WasiHttpCtxView<'_>
Available on crate feature
p2 only.Source§fn write(
&mut self,
id: Resource<HostOutgoingBody>,
) -> Result<Result<Resource<DynOutputStream>, ()>>
fn write( &mut self, id: Resource<HostOutgoingBody>, ) -> Result<Result<Resource<DynOutputStream>, ()>>
Returns a stream for writing the body contents. Read more
Source§fn finish(
&mut self,
id: Resource<HostOutgoingBody>,
ts: Option<Resource<Trailers>>,
) -> HttpResult<()>
fn finish( &mut self, id: Resource<HostOutgoingBody>, ts: Option<Resource<Trailers>>, ) -> HttpResult<()>
Finalize an outgoing body, optionally providing trailers. This must be
called to signal that the response is complete. If the
outgoing-body
is dropped without calling outgoing-body.finalize, the implementation
should treat the body as corrupted. Read morefn drop(&mut self, id: Resource<HostOutgoingBody>) -> Result<()>
Source§impl HostOutgoingRequest for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostOutgoingRequest for WasiHttpCtxView<'_>
Available on crate feature
p2 only.Source§fn new(
&mut self,
headers: Resource<FieldMap>,
) -> Result<Resource<HostOutgoingRequest>>
fn new( &mut self, headers: Resource<FieldMap>, ) -> Result<Resource<HostOutgoingRequest>>
Construct a new
outgoing-request with a default method of GET, and
none values for path-with-query, scheme, and authority. Read moreSource§fn body(
&mut self,
request: Resource<HostOutgoingRequest>,
) -> Result<Result<Resource<HostOutgoingBody>, ()>>
fn body( &mut self, request: Resource<HostOutgoingRequest>, ) -> Result<Result<Resource<HostOutgoingBody>, ()>>
Returns the resource corresponding to the outgoing Body for this
Request. Read more
fn drop(&mut self, request: Resource<HostOutgoingRequest>) -> Result<()>
Source§fn method(&mut self, request: Resource<OutgoingRequest>) -> Result<Method>
fn method(&mut self, request: Resource<OutgoingRequest>) -> Result<Method>
Get the Method for the Request.
Source§fn set_method(
&mut self,
request: Resource<OutgoingRequest>,
method: Method,
) -> Result<Result<(), ()>>
fn set_method( &mut self, request: 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,
request: Resource<OutgoingRequest>,
) -> Result<Option<String>>
fn path_with_query( &mut self, request: 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,
request: Resource<OutgoingRequest>,
path_with_query: Option<String>,
) -> Result<Result<(), ()>>
fn set_path_with_query( &mut self, request: 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,
request: Resource<OutgoingRequest>,
) -> Result<Option<Scheme>>
fn scheme( &mut self, request: 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,
request: Resource<OutgoingRequest>,
scheme: Option<Scheme>,
) -> Result<Result<(), ()>>
fn set_scheme( &mut self, request: 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§impl HostOutgoingResponse for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostOutgoingResponse for WasiHttpCtxView<'_>
Available on crate feature
p2 only.Source§fn new(
&mut self,
headers: Resource<FieldMap>,
) -> Result<Resource<HostOutgoingResponse>>
fn new( &mut self, headers: Resource<FieldMap>, ) -> Result<Resource<HostOutgoingResponse>>
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. Read moreSource§fn body(
&mut self,
id: Resource<HostOutgoingResponse>,
) -> Result<Result<Resource<HostOutgoingBody>, ()>>
fn body( &mut self, id: Resource<HostOutgoingResponse>, ) -> Result<Result<Resource<HostOutgoingBody>, ()>>
Returns the resource corresponding to the outgoing Body for this Response. Read more
Source§fn status_code(
&mut self,
id: Resource<HostOutgoingResponse>,
) -> Result<StatusCode>
fn status_code( &mut self, id: Resource<HostOutgoingResponse>, ) -> Result<StatusCode>
Get the HTTP Status Code for the Response.
Source§fn set_status_code(
&mut self,
id: Resource<HostOutgoingResponse>,
status: StatusCode,
) -> Result<Result<(), ()>>
fn set_status_code( &mut self, id: Resource<HostOutgoingResponse>, status: 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,
id: Resource<HostOutgoingResponse>,
) -> Result<Resource<FieldMap>>
fn headers( &mut self, id: Resource<HostOutgoingResponse>, ) -> Result<Resource<FieldMap>>
Get the headers associated with the Request. Read more
fn drop(&mut self, id: Resource<HostOutgoingResponse>) -> Result<()>
Source§impl HostRequest for WasiHttpCtxView<'_>
Available on crate feature p3 only.
impl HostRequest for WasiHttpCtxView<'_>
Available on crate feature
p3 only.Source§fn get_method(&mut self, req: Resource<Request>) -> Result<Method>
fn get_method(&mut self, req: Resource<Request>) -> Result<Method>
Get the Method for the Request.
Source§fn set_method(
&mut self,
req: Resource<Request>,
method: Method,
) -> Result<Result<(), ()>>
fn set_method( &mut self, req: Resource<Request>, 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 get_path_with_query(
&mut self,
req: Resource<Request>,
) -> Result<Option<String>>
fn get_path_with_query( &mut self, req: Resource<Request>, ) -> 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,
req: Resource<Request>,
path_with_query: Option<String>,
) -> Result<Result<(), ()>>
fn set_path_with_query( &mut self, req: Resource<Request>, 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 get_scheme(&mut self, req: Resource<Request>) -> Result<Option<Scheme>>
fn get_scheme(&mut self, req: Resource<Request>) -> 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,
req: Resource<Request>,
scheme: Option<Scheme>,
) -> Result<Result<(), ()>>
fn set_scheme( &mut self, req: Resource<Request>, 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 get_options(
&mut self,
req: Resource<Request>,
) -> Result<Option<Resource<RequestOptions>>>
fn get_options( &mut self, req: Resource<Request>, ) -> Result<Option<Resource<RequestOptions>>>
Get the
request-options to be associated with this request Read moreSource§impl HostRequestOptions for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostRequestOptions for WasiHttpCtxView<'_>
Available on crate feature
p2 only.Source§fn new(&mut self) -> Result<Resource<RequestOptions>>
fn new(&mut self) -> Result<Resource<RequestOptions>>
Construct a default
request-options value.Source§fn connect_timeout(
&mut self,
opts: Resource<RequestOptions>,
) -> Result<Option<Duration>>
fn connect_timeout( &mut self, opts: Resource<RequestOptions>, ) -> Result<Option<Duration>>
The timeout for the initial connect to the HTTP Server.
Source§fn set_connect_timeout(
&mut self,
opts: Resource<RequestOptions>,
duration: Option<Duration>,
) -> Result<Result<(), ()>>
fn set_connect_timeout( &mut self, opts: Resource<RequestOptions>, duration: Option<Duration>, ) -> Result<Result<(), ()>>
Set the timeout for the initial connect to the HTTP Server. An error
return value indicates that this timeout is not supported.
Source§fn first_byte_timeout(
&mut self,
opts: Resource<RequestOptions>,
) -> Result<Option<Duration>>
fn first_byte_timeout( &mut self, opts: Resource<RequestOptions>, ) -> Result<Option<Duration>>
The timeout for receiving the first byte of the Response body.
Source§fn set_first_byte_timeout(
&mut self,
opts: Resource<RequestOptions>,
duration: Option<Duration>,
) -> Result<Result<(), ()>>
fn set_first_byte_timeout( &mut self, opts: Resource<RequestOptions>, duration: Option<Duration>, ) -> Result<Result<(), ()>>
Set the timeout for receiving the first byte of the Response body. An
error return value indicates that this timeout is not supported.
Source§fn between_bytes_timeout(
&mut self,
opts: Resource<RequestOptions>,
) -> Result<Option<Duration>>
fn between_bytes_timeout( &mut self, opts: Resource<RequestOptions>, ) -> Result<Option<Duration>>
The timeout for receiving subsequent chunks of bytes in the Response
body stream.
Source§fn set_between_bytes_timeout(
&mut self,
opts: Resource<RequestOptions>,
duration: Option<Duration>,
) -> Result<Result<(), ()>>
fn set_between_bytes_timeout( &mut self, opts: Resource<RequestOptions>, duration: Option<Duration>, ) -> Result<Result<(), ()>>
Set the timeout for receiving subsequent chunks of bytes in the Response
body stream. An error return value indicates that this timeout is not
supported.
fn drop(&mut self, rep: Resource<RequestOptions>) -> Result<()>
Source§impl HostRequestOptions for WasiHttpCtxView<'_>
Available on crate feature p3 only.
impl HostRequestOptions for WasiHttpCtxView<'_>
Available on crate feature
p3 only.Source§fn new(&mut self) -> Result<Resource<RequestOptions>>
fn new(&mut self) -> Result<Resource<RequestOptions>>
Construct a default
request-options value.Source§fn get_connect_timeout(
&mut self,
opts: Resource<RequestOptions>,
) -> Result<Option<Duration>>
fn get_connect_timeout( &mut self, opts: Resource<RequestOptions>, ) -> Result<Option<Duration>>
The timeout for the initial connect to the HTTP Server.
Source§fn set_connect_timeout(
&mut self,
opts: Resource<RequestOptions>,
duration: Option<Duration>,
) -> Result<(), TrappableError<RequestOptionsError>>
fn set_connect_timeout( &mut self, opts: Resource<RequestOptions>, duration: Option<Duration>, ) -> Result<(), TrappableError<RequestOptionsError>>
Set the timeout for the initial connect to the HTTP Server. An error
return value indicates that this timeout is not supported or that this
handle is immutable.
Source§fn get_first_byte_timeout(
&mut self,
opts: Resource<RequestOptions>,
) -> Result<Option<Duration>>
fn get_first_byte_timeout( &mut self, opts: Resource<RequestOptions>, ) -> Result<Option<Duration>>
The timeout for receiving the first byte of the Response body.
Source§fn set_first_byte_timeout(
&mut self,
opts: Resource<RequestOptions>,
duration: Option<Duration>,
) -> Result<(), TrappableError<RequestOptionsError>>
fn set_first_byte_timeout( &mut self, opts: Resource<RequestOptions>, duration: Option<Duration>, ) -> Result<(), TrappableError<RequestOptionsError>>
Set the timeout for receiving the first byte of the Response body. An
error return value indicates that this timeout is not supported or that
this handle is immutable.
Source§fn get_between_bytes_timeout(
&mut self,
opts: Resource<RequestOptions>,
) -> Result<Option<Duration>>
fn get_between_bytes_timeout( &mut self, opts: Resource<RequestOptions>, ) -> Result<Option<Duration>>
The timeout for receiving subsequent chunks of bytes in the Response
body stream.
Source§fn set_between_bytes_timeout(
&mut self,
opts: Resource<RequestOptions>,
duration: Option<Duration>,
) -> Result<(), TrappableError<RequestOptionsError>>
fn set_between_bytes_timeout( &mut self, opts: Resource<RequestOptions>, duration: Option<Duration>, ) -> Result<(), TrappableError<RequestOptionsError>>
Set the timeout for receiving subsequent chunks of bytes in the Response
body stream. An error return value indicates that this timeout is not
supported or that this handle is immutable.
Source§fn clone(
&mut self,
opts: Resource<RequestOptions>,
) -> Result<Resource<RequestOptions>>
fn clone( &mut self, opts: Resource<RequestOptions>, ) -> Result<Resource<RequestOptions>>
Make a deep copy of the
request-options.
The resulting request-options is mutable.fn drop(&mut self, opts: Resource<RequestOptions>) -> Result<()>
Source§impl HostResponse for WasiHttpCtxView<'_>
Available on crate feature p3 only.
impl HostResponse for WasiHttpCtxView<'_>
Available on crate feature
p3 only.Source§fn get_status_code(&mut self, res: Resource<Response>) -> Result<StatusCode>
fn get_status_code(&mut self, res: Resource<Response>) -> Result<StatusCode>
Get the HTTP Status Code for the Response.
Source§fn set_status_code(
&mut self,
res: Resource<Response>,
status_code: StatusCode,
) -> Result<Result<(), ()>>
fn set_status_code( &mut self, res: Resource<Response>, 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§impl HostResponseOutparam for WasiHttpCtxView<'_>
Available on crate feature p2 only.
impl HostResponseOutparam for WasiHttpCtxView<'_>
Available on crate feature
p2 only.fn drop(&mut self, id: Resource<HostResponseOutparam>) -> Result<()>
Source§fn set(
&mut self,
id: Resource<HostResponseOutparam>,
resp: Result<Resource<HostOutgoingResponse>, ErrorCode>,
) -> Result<()>
fn set( &mut self, id: Resource<HostResponseOutparam>, resp: Result<Resource<HostOutgoingResponse>, ErrorCode>, ) -> Result<()>
Set the value of the
response-outparam to either send a response,
or indicate an error. Read moreSource§fn send_informational(
&mut self,
_id: Resource<HostResponseOutparam>,
_status: u16,
_headers: Resource<FieldMap>,
) -> HttpResult<()>
fn send_informational( &mut self, _id: Resource<HostResponseOutparam>, _status: u16, _headers: Resource<FieldMap>, ) -> HttpResult<()>
Send an HTTP 1xx response. Read more
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for WasiHttpCtxView<'a>
impl<'a> !Sync for WasiHttpCtxView<'a>
impl<'a> !UnwindSafe for WasiHttpCtxView<'a>
impl<'a> Freeze for WasiHttpCtxView<'a>
impl<'a> Send for WasiHttpCtxView<'a>
impl<'a> Unpin for WasiHttpCtxView<'a>
impl<'a> UnsafeUnpin for WasiHttpCtxView<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more