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 */
}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)
Construct a new Request from http::Request.
This returns a Future that will be used to communicate a request processing error, if any.
Requests constructed this way will not perform any Content-Length validation.
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
Source§impl<T> GetSetFdFlags for T
impl<T> GetSetFdFlags for T
Source§fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
fn get_fd_flags(&self) -> Result<FdFlags, Error>where
T: AsFilelike,
self file descriptor.Source§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,
Source§fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
fn set_fd_flags(&mut self, set_fd_flags: SetFdFlags<T>) -> Result<(), Error>where
T: AsFilelike,
self file descriptor. Read more