pub struct Image {
pub id: String,
pub href: String,
pub media_type: String,
pub content: Option<Vec<u8>>,
}Expand description
An image extracted from an EPUB file.
Images include both the metadata (ID, href, media type) and optionally the binary content. The first image in the EPUB’s images vector is typically the cover image.
§Example
use epub_parser::Image;
let image = Image {
id: "cover".to_string(),
href: "images/cover.jpg".to_string(),
media_type: "image/jpeg".to_string(),
content: None,
};
println!("Image: {} ({})", image.href, image.media_type);Fields§
§id: StringThe unique identifier for this image from the manifest.
This corresponds to the id attribute in the OPF manifest.
href: StringThe path to the image within the EPUB archive.
This is a relative path that can be used to locate the image file within the EPUB’s ZIP structure.
media_type: StringThe MIME type of the image.
Common values include “image/jpeg”, “image/png”, “image/gif”, etc.
content: Option<Vec<u8>>The binary content of the image.
This is Some(Vec<u8>) if the image was successfully read,
or None if the image file could not be found or read.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Image
impl RefUnwindSafe for Image
impl Send for Image
impl Sync for Image
impl Unpin for Image
impl UnwindSafe for Image
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