pub struct Request {
pub method: Method,
pub scheme: Option<Scheme>,
pub authority: Option<Authority>,
pub path_with_query: Option<PathAndQuery>,
pub headers: Arc<HeaderMap>,
pub options: Option<Arc<RequestOptions>>,
/* private fields */
}Available on crate feature
p3 only.Expand description
The concrete type behind a wasi:http/types.request resource.
Fields§
§method: MethodThe method of the request.
scheme: Option<Scheme>The scheme of the request.
The authority of the request.
path_with_query: Option<PathAndQuery>The path and query of the request.
headers: Arc<HeaderMap>The request headers.
options: Option<Arc<RequestOptions>>Request options.
Implementations§
Source§impl Request
impl Request
Sourcepub fn new(
method: Method,
scheme: Option<Scheme>,
authority: Option<Authority>,
path_with_query: Option<PathAndQuery>,
headers: impl Into<Arc<HeaderMap>>,
options: Option<Arc<RequestOptions>>,
body: impl Into<UnsyncBoxBody<Bytes, ErrorCode>>,
) -> (Self, impl Future<Output = Result<(), ErrorCode>> + Send + 'static)
pub fn new( method: Method, scheme: Option<Scheme>, authority: Option<Authority>, path_with_query: Option<PathAndQuery>, headers: impl Into<Arc<HeaderMap>>, options: Option<Arc<RequestOptions>>, body: impl Into<UnsyncBoxBody<Bytes, ErrorCode>>, ) -> (Self, impl Future<Output = Result<(), ErrorCode>> + Send + 'static)
Sourcepub fn from_http<T>(
req: Request<T>,
) -> (Self, impl Future<Output = Result<(), ErrorCode>> + Send + 'static)
pub fn from_http<T>( req: Request<T>, ) -> (Self, impl Future<Output = Result<(), ErrorCode>> + Send + 'static)
Sourcepub fn into_http<T: WasiHttpView + 'static>(
self,
store: impl AsContextMut<Data = T>,
fut: impl Future<Output = Result<(), ErrorCode>> + Send + 'static,
) -> Result<(Request<UnsyncBoxBody<Bytes, ErrorCode>>, Option<Arc<RequestOptions>>), ErrorCode>
pub fn into_http<T: WasiHttpView + 'static>( self, store: impl AsContextMut<Data = T>, fut: impl Future<Output = Result<(), ErrorCode>> + Send + 'static, ) -> Result<(Request<UnsyncBoxBody<Bytes, ErrorCode>>, Option<Arc<RequestOptions>>), ErrorCode>
Convert this Request into an [http::Request<UnsyncBoxBody<Bytes, ErrorCode>>].
The specified future fut can be used to communicate a request processing
error, if any, back to the caller (e.g., if this request was constructed
through wasi:http/types.request#new).
Sourcepub fn into_http_with_getter<T: 'static>(
self,
store: impl AsContextMut<Data = T>,
fut: impl Future<Output = Result<(), ErrorCode>> + Send + 'static,
getter: fn(&mut T) -> WasiHttpCtxView<'_>,
) -> Result<(Request<UnsyncBoxBody<Bytes, ErrorCode>>, Option<Arc<RequestOptions>>), ErrorCode>
pub fn into_http_with_getter<T: 'static>( self, store: impl AsContextMut<Data = T>, fut: impl Future<Output = Result<(), ErrorCode>> + Send + 'static, getter: fn(&mut T) -> WasiHttpCtxView<'_>, ) -> Result<(Request<UnsyncBoxBody<Bytes, ErrorCode>>, Option<Arc<RequestOptions>>), ErrorCode>
Like Self::into_http, but uses a custom getter for obtaining the WasiHttpCtxView.
Auto Trait Implementations§
impl !Freeze for Request
impl !RefUnwindSafe for Request
impl Send for Request
impl !Sync for Request
impl Unpin for Request
impl !UnwindSafe for Request
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