pub struct MessageImage { /* private fields */ }Expand description
One encoded image a frontend sends with a chat message, whose bytes the host writes to its own prompt-image directory and attaches to the turn.
Only PNG and JPEG files are accepted, recognized by their signature, so the host never trusts a name or media type the sender chose.
Implementations§
Source§impl MessageImage
impl MessageImage
Sourcepub fn new(data: Vec<u8>) -> Result<Self, SessionError>
pub fn new(data: Vec<u8>) -> Result<Self, SessionError>
Wraps the encoded bytes of one PNG or JPEG image.
§Errors
Returns an error when data is neither a PNG nor a JPEG file.
Sourcepub fn format(&self) -> MessageImageFormat
pub fn format(&self) -> MessageImageFormat
Returns the image’s file format.
Trait Implementations§
Source§impl Clone for MessageImage
impl Clone for MessageImage
Source§impl Debug for MessageImage
impl Debug for MessageImage
impl Eq for MessageImage
Source§impl PartialEq for MessageImage
impl PartialEq for MessageImage
impl StructuralPartialEq for MessageImage
Auto Trait Implementations§
impl Forget for MessageImage
impl Freeze for MessageImage
impl Move for MessageImage
impl RefUnwindSafe for MessageImage
impl Send for MessageImage
impl Sync for MessageImage
impl Unpin for MessageImage
impl UnsafeUnpin for MessageImage
impl UnwindSafe for MessageImage
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.