[−][src]Struct seed::browser::fetch::Response
Response of the fetch request.
To get one you need to use fetch
function.
Implementations
impl Response
[src]
pub async fn text<'_>(&'_ self) -> Result<String>
[src]
pub async fn json<'_, T: DeserializeOwned + 'static>(&'_ self) -> Result<T>
[src]
JSON parse response body into provided type.
Errors
Returns FetchError::SerdeError
or FetchError::PromiseError
.
pub async fn bytes<'_>(&'_ self) -> Result<Vec<u8>>
[src]
pub fn status(&self) -> Status
[src]
Get request status.
pub fn check_status(self) -> Result<Self>
[src]
Check that response status is ok (2xx).
fetch(url).await?.check_status()?
Or with combinators:
fetch(url) .map(|result| result.and_then(Response::check_status)) .and_then(Response.json) .map(Msg::Fetched)
Errors
Returns FetchError::StatusError
if status isn't 2xx.
pub const fn raw_response(&self) -> &Response
[src]
Get underlying web_sys::Response
.
This is an escape path if current API can't handle your needs. Should you find yourself using it, please consider opening an issue.
Auto Trait Implementations
impl RefUnwindSafe for Response
impl !Send for Response
impl !Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Sealed<T> for T where
T: ?Sized,
T: ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,