[][src]Struct iiif::Response

pub struct Response {
    pub status_code: u16,
    pub url: Url,
    pub image: Bytes,
}

Generic response struct containing a byte array of the image the final url and status code returned

Fields

status_code: u16url: Urlimage: Bytes

Methods

impl Response[src]

pub async fn write_to_file<'_>(self, path: &'_ str) -> Result<()>[src]

Writes the image response to a file at the specified relative or absolute path

Example

This example is not tested
use iiif::*;
let client = Client::new();
let mut api = Image::new("https://ids.lib.harvard.edu/ids/iiif/");
api.identifier = "25286607".into();
api.request(&client)
    .await
    .write_to_file("foo.jpg")
    .await
    .expect("Writing file to disk");

Trait Implementations

impl Clone for Response[src]

impl Debug for Response[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.