pub struct ImageMetadata {
pub src: String,
pub alt: Option<String>,
pub title: Option<String>,
pub dimensions: Option<(u32, u32)>,
pub image_type: ImageType,
pub attributes: BTreeMap<String, String>,
}Expand description
Image metadata with source and dimensions.
Captures <img> elements and inline <svg> elements with metadata
for image analysis and optimization.
§Examples
let img = ImageMetadata {
src: "https://example.com/image.jpg".to_string(),
alt: Some("An example image".to_string()),
title: Some("Example".to_string()),
dimensions: Some((800, 600)),
image_type: ImageType::External,
attributes: Default::default(),
};
assert_eq!(img.image_type, ImageType::External);Fields§
§src: StringImage source (URL, data URI, or SVG content identifier)
alt: Option<String>Alternative text from alt attribute (for accessibility)
title: Option<String>Title attribute (often shown as tooltip)
dimensions: Option<(u32, u32)>Image dimensions as (width, height) if available
image_type: ImageTypeImage type classification
attributes: BTreeMap<String, String>Additional HTML attributes
Trait Implementations§
Source§impl Clone for ImageMetadata
impl Clone for ImageMetadata
Source§fn clone(&self) -> ImageMetadata
fn clone(&self) -> ImageMetadata
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ImageMetadata
impl Debug for ImageMetadata
Source§impl<'de> Deserialize<'de> for ImageMetadata
impl<'de> Deserialize<'de> for ImageMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ImageMetadata
impl RefUnwindSafe for ImageMetadata
impl Send for ImageMetadata
impl Sync for ImageMetadata
impl Unpin for ImageMetadata
impl UnwindSafe for ImageMetadata
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)