pub struct Image {
pub file_ref: FileRef,
pub width: Option<u32>,
pub height: Option<u32>,
pub alt_text: Option<String>,
pub caption: Option<String>,
pub format: Option<String>,
pub metadata: Vec<Metadata>,
}Expand description
Image reference with metadata
Contains a file reference to an image along with image-specific metadata such as dimensions, format, and other properties useful for displaying images.
Fields§
§file_ref: FileRefReference to the stored image file
width: Option<u32>Image width in pixels (if known)
height: Option<u32>Image height in pixels (if known)
alt_text: Option<String>Alternative text for accessibility
caption: Option<String>Human-readable caption or description
format: Option<String>Image format (e.g., “PNG”, “JPEG”, “WEBP”) This may differ from content_type in the FileRef as it’s more specific to images
metadata: Vec<Metadata>Additional image-specific metadata using structured types
Implementations§
Source§impl Image
impl Image
Sourcepub fn with_dimensions(self, width: u32, height: u32) -> Image
pub fn with_dimensions(self, width: u32, height: u32) -> Image
Set image dimensions
Sourcepub fn with_alt_text(self, alt_text: String) -> Image
pub fn with_alt_text(self, alt_text: String) -> Image
Set alternative text for accessibility
Sourcepub fn with_caption(self, caption: String) -> Image
pub fn with_caption(self, caption: String) -> Image
Set image caption or description
Sourcepub fn with_format(self, format: String) -> Image
pub fn with_format(self, format: String) -> Image
Set image format
Sourcepub fn with_metadata(self, key: String, value: String) -> Image
pub fn with_metadata(self, key: String, value: String) -> Image
Add generic metadata to the image
Sourcepub fn with_structured_metadata(self, metadata: Metadata) -> Image
pub fn with_structured_metadata(self, metadata: Metadata) -> Image
Add structured metadata to the image
Sourcepub fn generic_metadata(&self) -> BTreeMap<String, String>
pub fn generic_metadata(&self) -> BTreeMap<String, String>
Get all generic metadata as a key-value map for backward compatibility
This method extracts only the Metadata::Generic(key, value) entries and returns them
as a BTreeMap<String, String> for backward compatibility with APIs that expect
key-value metadata.
Sourcepub fn aspect_ratio(&self) -> Option<f32>
pub fn aspect_ratio(&self) -> Option<f32>
Get the aspect ratio (width/height) if dimensions are available
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Image
impl<'de> Deserialize<'de> for Image
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Image, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Image, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Image
impl Serialize for Image
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Eq for Image
impl StructuralPartialEq for Image
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
§impl<T> Classify for T
impl<T> Classify for T
type Classified = T
fn classify(self) -> T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<T> Declassify for T
impl<T> Declassify for T
type Declassified = T
fn declassify(self) -> T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.