pub struct ImageAttachment {
pub path: PathBuf,
pub mime_type: String,
pub base64_data: String,
pub size_bytes: u64,
pub dimensions: Option<(u32, u32)>,
}Expand description
An image attachment for multimodal chat messages.
Stores both the filesystem path (for reference) and the base64-encoded content (for self-contained session persistence).
Fields§
§path: PathBufOriginal path the image was loaded from (for display and /image listing).
mime_type: StringMIME type (e.g. “image/png”, “image/jpeg”).
base64_data: StringBase64-encoded image bytes (without the data: prefix).
size_bytes: u64File size in bytes.
dimensions: Option<(u32, u32)>Image dimensions: (width, height) in pixels, if detectable. Currently not parsed; reserved for future use.
Implementations§
Source§impl ImageAttachment
impl ImageAttachment
Sourcepub fn load(path: PathBuf) -> Result<Self, ImageError>
pub fn load(path: PathBuf) -> Result<Self, ImageError>
Load an image from disk, encode it as base64, and validate.
Rejects files larger than MAX_IMAGE_BYTES and files with unsupported
MIME types (based on extension).
Sourcepub fn load_from_str(path_str: &str) -> Result<Self, ImageError>
pub fn load_from_str(path_str: &str) -> Result<Self, ImageError>
Load an image from disk with an absolute path. Convenience wrapper that canonicalises the path.
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Display name (file name, fallback to full path).
Sourcepub fn size_display(&self) -> String
pub fn size_display(&self) -> String
Human-readable size.
Sourcepub fn exists_on_disk(&self) -> bool
pub fn exists_on_disk(&self) -> bool
Returns true if the file still exists on disk.
Trait Implementations§
Source§impl Clone for ImageAttachment
impl Clone for ImageAttachment
Source§fn clone(&self) -> ImageAttachment
fn clone(&self) -> ImageAttachment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more