pub struct Response {
pub status_code: u16,
pub url: Url,
pub image: Bytes,
}
Expand description
Generic response struct containing a byte array of the image the final url and status code returned
Fields§
§status_code: u16
§url: Url
§image: Bytes
Implementations§
Source§impl Response
impl Response
Sourcepub async fn write_to_file(self, path: &str) -> Result<()>
pub async fn write_to_file(self, path: &str) -> Result<()>
Writes the image response to a file at the specified relative or absolute path
§Example
ⓘ
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§
Auto Trait Implementations§
impl !Freeze for Response
impl RefUnwindSafe for Response
impl Send for Response
impl Sync for Response
impl Unpin for Response
impl UnwindSafe for Response
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