Struct BrowserRequest
pub struct BrowserRequest(pub(crate) SendWrapper<RequestInner>);Available on crate feature
browser only.Expand description
A fetch request made in the browser.
Tuple Fieldsยง
ยง0: SendWrapper<RequestInner>Methods from Deref<Target = Request>ยง
pub fn headers(&self) -> Headers
pub fn headers(&self) -> Headers
Gets the headers.
pub fn body_used(&self) -> bool
pub fn body_used(&self) -> bool
Has the request body been consumed?
If true, then any future attempts to consume the body will error.
pub fn body(&self) -> Option<ReadableStream>
pub fn body(&self) -> Option<ReadableStream>
Gets the body.
pub async fn form_data(&self) -> Result<FormData, Error>
pub async fn form_data(&self) -> Result<FormData, Error>
Reads the request to completion, returning it as FormData.
pub async fn json<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
Available on crate feature json only.
pub async fn json<T>(&self) -> Result<T, Error>where
T: DeserializeOwned,
json only.Reads the request to completion, parsing it as JSON.
pub async fn binary(&self) -> Result<Vec<u8>, Error>
pub async fn binary(&self) -> Result<Vec<u8>, Error>
Gets the binary request
This works by obtaining the response as an ArrayBuffer, creating a Uint8Array from it
and then converting it to Vec<u8>
pub fn mode(&self) -> RequestMode
pub fn mode(&self) -> RequestMode
Return the read only mode for the request
Trait Implementationsยง
ยงimpl<E> ClientReq<E> for BrowserRequestwhere
E: FromServerFnError,
impl<E> ClientReq<E> for BrowserRequestwhere
E: FromServerFnError,
ยงtype FormData = BrowserFormData
type FormData = BrowserFormData
The type used for URL-encoded form data in this client.
ยงfn try_new_req_query(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
method: Method,
) -> Result<BrowserRequest, E>
fn try_new_req_query( path: &str, content_type: &str, accepts: &str, query: &str, method: Method, ) -> Result<BrowserRequest, E>
Attempts to construct a new request with query parameters.
ยงfn try_new_req_text(
path: &str,
content_type: &str,
accepts: &str,
body: String,
method: Method,
) -> Result<BrowserRequest, E>
fn try_new_req_text( path: &str, content_type: &str, accepts: &str, body: String, method: Method, ) -> Result<BrowserRequest, E>
Attempts to construct a new request with a text body.
ยงfn try_new_req_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
method: Method,
) -> Result<BrowserRequest, E>
fn try_new_req_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, method: Method, ) -> Result<BrowserRequest, E>
Attempts to construct a new request with a binary body.
ยงfn try_new_req_multipart(
path: &str,
accepts: &str,
body: <BrowserRequest as ClientReq<E>>::FormData,
method: Method,
) -> Result<BrowserRequest, E>
fn try_new_req_multipart( path: &str, accepts: &str, body: <BrowserRequest as ClientReq<E>>::FormData, method: Method, ) -> Result<BrowserRequest, E>
Attempts to construct a new request with a multipart body.
ยงfn try_new_req_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: <BrowserRequest as ClientReq<E>>::FormData,
method: Method,
) -> Result<BrowserRequest, E>
fn try_new_req_form_data( path: &str, accepts: &str, content_type: &str, body: <BrowserRequest as ClientReq<E>>::FormData, method: Method, ) -> Result<BrowserRequest, E>
Attempts to construct a new request with form data as the body.
ยงfn try_new_req_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + 'static,
method: Method,
) -> Result<BrowserRequest, E>
fn try_new_req_streaming( path: &str, accepts: &str, content_type: &str, body: impl Stream<Item = Bytes> + 'static, method: Method, ) -> Result<BrowserRequest, E>
Attempts to construct a new request with a streaming body.
ยงfn try_new_get(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
) -> Result<Self, E>
fn try_new_get( path: &str, content_type: &str, accepts: &str, query: &str, ) -> Result<Self, E>
Attempts to construct a new
GET request.ยงfn try_new_delete(
path: &str,
content_type: &str,
accepts: &str,
query: &str,
) -> Result<Self, E>
fn try_new_delete( path: &str, content_type: &str, accepts: &str, query: &str, ) -> Result<Self, E>
Attempts to construct a new
DELETE request.
Note: Browser support for DELETE requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_post(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E>
fn try_new_post( path: &str, content_type: &str, accepts: &str, body: String, ) -> Result<Self, E>
Attempts to construct a new
POST request with a text body.ยงfn try_new_patch(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E>
fn try_new_patch( path: &str, content_type: &str, accepts: &str, body: String, ) -> Result<Self, E>
Attempts to construct a new
PATCH request with a text body.
Note: Browser support for PATCH requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_put(
path: &str,
content_type: &str,
accepts: &str,
body: String,
) -> Result<Self, E>
fn try_new_put( path: &str, content_type: &str, accepts: &str, body: String, ) -> Result<Self, E>
Attempts to construct a new
PUT request with a text body.
Note: Browser support for PUT requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_post_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E>
fn try_new_post_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, ) -> Result<Self, E>
Attempts to construct a new
POST request with a binary body.ยงfn try_new_patch_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E>
fn try_new_patch_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, ) -> Result<Self, E>
Attempts to construct a new
PATCH request with a binary body.
Note: Browser support for PATCH requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_put_bytes(
path: &str,
content_type: &str,
accepts: &str,
body: Bytes,
) -> Result<Self, E>
fn try_new_put_bytes( path: &str, content_type: &str, accepts: &str, body: Bytes, ) -> Result<Self, E>
Attempts to construct a new
PUT request with a binary body.
Note: Browser support for PUT requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_post_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_post_form_data( path: &str, accepts: &str, content_type: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new
POST request with form data as the body.ยงfn try_new_patch_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_patch_form_data( path: &str, accepts: &str, content_type: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new
PATCH request with form data as the body.
Note: Browser support for PATCH requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_put_form_data(
path: &str,
accepts: &str,
content_type: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_put_form_data( path: &str, accepts: &str, content_type: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new
PUT request with form data as the body.
Note: Browser support for PUT requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_post_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_post_multipart( path: &str, accepts: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new
POST request with a multipart body.ยงfn try_new_patch_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_patch_multipart( path: &str, accepts: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new
PATCH request with a multipart body.
Note: Browser support for PATCH requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_put_multipart(
path: &str,
accepts: &str,
body: Self::FormData,
) -> Result<Self, E>
fn try_new_put_multipart( path: &str, accepts: &str, body: Self::FormData, ) -> Result<Self, E>
Attempts to construct a new
PUT request with a multipart body.
Note: Browser support for PUT requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_post_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E>
fn try_new_post_streaming( path: &str, accepts: &str, content_type: &str, body: impl Stream<Item = Bytes> + Send + 'static, ) -> Result<Self, E>
Attempts to construct a new
POST request with a streaming body.ยงfn try_new_patch_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E>
fn try_new_patch_streaming( path: &str, accepts: &str, content_type: &str, body: impl Stream<Item = Bytes> + Send + 'static, ) -> Result<Self, E>
Attempts to construct a new
PATCH request with a streaming body.
Note: Browser support for PATCH requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงfn try_new_put_streaming(
path: &str,
accepts: &str,
content_type: &str,
body: impl Stream<Item = Bytes> + Send + 'static,
) -> Result<Self, E>
fn try_new_put_streaming( path: &str, accepts: &str, content_type: &str, body: impl Stream<Item = Bytes> + Send + 'static, ) -> Result<Self, E>
Attempts to construct a new
PUT request with a streaming body.
Note: Browser support for PUT requests without JS/WASM may be poor.
Consider using a POST request if functionality without JS/WASM is required.ยงimpl Debug for BrowserRequest
impl Debug for BrowserRequest
ยงimpl Deref for BrowserRequest
impl Deref for BrowserRequest
ยงimpl DerefMut for BrowserRequest
impl DerefMut for BrowserRequest
ยงfn deref_mut(&mut self) -> &mut <BrowserRequest as Deref>::Target
fn deref_mut(&mut self) -> &mut <BrowserRequest as Deref>::Target
Mutably dereferences the value.
ยงimpl From<BrowserRequest> for Request
impl From<BrowserRequest> for Request
ยงfn from(value: BrowserRequest) -> Request
fn from(value: BrowserRequest) -> Request
Converts to this type from the input type.
ยงimpl From<BrowserRequest> for Request
impl From<BrowserRequest> for Request
ยงfn from(value: BrowserRequest) -> Request
fn from(value: BrowserRequest) -> Request
Converts to this type from the input type.
Auto Trait Implementationsยง
impl Freeze for BrowserRequest
impl RefUnwindSafe for BrowserRequest
impl Send for BrowserRequest
impl Sync for BrowserRequest
impl Unpin for BrowserRequest
impl UnwindSafe for BrowserRequest
Blanket Implementationsยง
Sourceยงimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Sourceยงfn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Convert the source color to the destination color using the specified
method.
Sourceยงfn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford
method by default.
Sourceยงimpl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Sourceยงfn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Cast a collection of colors into a collection of arrays.
Sourceยงimpl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Sourceยงfn arrays_into(self) -> C
fn arrays_into(self) -> C
Cast this collection of arrays into a collection of colors.
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
Sourceยงimpl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Sourceยงtype Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
The number type thatโs used in
parameters when converting.Sourceยงfn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
Converts
self into C, using the provided parameters.Sourceยงimpl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Sourceยงfn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Cast a collection of colors into a collection of color components.
ยงimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
ยงfn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.ยงfn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.ยงfn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Anyโs vtable from &Traitโs.ยงfn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Anyโs vtable from &mut Traitโs.ยงimpl<T> DowncastSend for T
impl<T> DowncastSend for T
ยงimpl<T> DowncastSync for T
impl<T> DowncastSync for T
Sourceยงimpl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Sourceยงfn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
Performs a conversion from
angle.Sourceยงimpl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Sourceยงfn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
Converts
other into Self, while performing the appropriate scaling,
rounding and clamping.ยงimpl<T> Instrument for T
impl<T> Instrument for T
ยงfn instrument(self, span: Span) -> Instrumented<Self> โ
fn instrument(self, span: Span) -> Instrumented<Self> โ
Sourceยงimpl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Sourceยงfn into_angle(self) -> U
fn into_angle(self) -> U
Performs a conversion into
T.Sourceยงimpl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Sourceยงtype Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
The number type thatโs used in
parameters when converting.Sourceยงfn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
Converts
self into C, using the provided parameters.Sourceยงimpl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Sourceยงfn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
Sourceยงimpl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Sourceยงfn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
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ยงimpl<T, I> IntoReactiveValue<T, __IntoReactiveValueMarkerBaseCase> for Iwhere
I: Into<T>,
impl<T, I> IntoReactiveValue<T, __IntoReactiveValueMarkerBaseCase> for Iwhere
I: Into<T>,
ยงfn into_reactive_value(self) -> T
fn into_reactive_value(self) -> T
Converts
self into a T.Sourceยงimpl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Sourceยงfn into_stimulus(self) -> T
fn into_stimulus(self) -> T
Converts
self into T, while performing the appropriate scaling,
rounding and clamping.ยงimpl<T> Pointable for T
impl<T> Pointable for T
ยงimpl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
ยงimpl<T> SerializableKey for T
impl<T> SerializableKey for T
ยงimpl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
ยงfn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
ยงfn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.
Sourceยงimpl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Sourceยงtype Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
The error for when
try_into_colors fails to cast.Sourceยงfn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Try to cast this collection of color components into a collection of
colors. Read more
Sourceยงimpl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Sourceยงfn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an
OutOfBounds error is returned which contains
the unclamped color. Read moreSourceยงimpl<C, U> UintsFrom<C> for Uwhere
C: IntoUints<U>,
impl<C, U> UintsFrom<C> for Uwhere
C: IntoUints<U>,
Sourceยงfn uints_from(colors: C) -> U
fn uints_from(colors: C) -> U
Cast a collection of colors into a collection of unsigned integers.
Sourceยงimpl<C, U> UintsInto<C> for Uwhere
C: FromUints<U>,
impl<C, U> UintsInto<C> for Uwhere
C: FromUints<U>,
Sourceยงfn uints_into(self) -> C
fn uints_into(self) -> C
Cast this collection of unsigned integers into a collection of colors.