pub struct WasiHttpCtxView<'a> {
pub ctx: &'a mut dyn WasiHttpCtx,
pub table: &'a mut ResourceTable,
}
Available on crate feature
p3
only.Expand description
View into WasiHttpCtx implementation and ResourceTable.
Fields§
§ctx: &'a mut dyn WasiHttpCtx
Mutable reference to the WASI HTTP context.
table: &'a mut ResourceTable
Mutable reference to table used to manage resources.
Trait Implementations§
Source§impl Host for WasiHttpCtxView<'_>
impl Host for WasiHttpCtxView<'_>
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<'_>
impl HostFields for WasiHttpCtxView<'_>
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,
value: Vec<FieldValue>,
) -> Result<(), TrappableError<HeaderError>>
fn set( &mut self, fields: Resource<Fields>, name: FieldName, value: 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 HostRequest for WasiHttpCtxView<'_>
impl HostRequest for WasiHttpCtxView<'_>
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<'_>
impl HostRequestOptions for WasiHttpCtxView<'_>
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<'_>
impl HostResponse for WasiHttpCtxView<'_>
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.
impl Host for WasiHttpCtxView<'_>
Auto Trait Implementations§
impl<'a> Freeze for WasiHttpCtxView<'a>
impl<'a> !RefUnwindSafe for WasiHttpCtxView<'a>
impl<'a> Send for WasiHttpCtxView<'a>
impl<'a> !Sync for WasiHttpCtxView<'a>
impl<'a> Unpin for WasiHttpCtxView<'a>
impl<'a> !UnwindSafe 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
§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
Query the “status” flags for the
self
file descriptor.§fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
fn new_set_fd_flags(&self, fd_flags: FdFlags) -> Result<SetFdFlags<T>, Error>where
T: AsFilelike,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more