Struct matrix_sdk::attachment::AttachmentConfig
source · [−]pub struct AttachmentConfig<'a> { /* private fields */ }Expand description
Configuration for sending an attachment.
Implementations
sourceimpl AttachmentConfig<'static>
impl AttachmentConfig<'static>
sourcepub fn new() -> Self
pub fn new() -> Self
Create a new default AttachmentConfig without providing a thumbnail.
To provide a thumbnail use AttachmentConfig::with_thumbnail().
sourcepub fn generate_thumbnail(self, size: Option<(u32, u32)>) -> Self
Available on crate feature image-proc only.
pub fn generate_thumbnail(self, size: Option<(u32, u32)>) -> Self
image-proc only.Generate the thumbnail to send for this media.
Uses generate_image_thumbnail().
Thumbnails can only be generated for supported image attachments. For more information, see the image crate.
Arguments
size- The size of the thumbnail in pixels as a(width, height)tuple. If set toNone, defaults to(800, 600).
sourceimpl<'a> AttachmentConfig<'a>
impl<'a> AttachmentConfig<'a>
sourcepub fn with_thumbnail(thumbnail: Thumbnail<'a>) -> Self
pub fn with_thumbnail(thumbnail: Thumbnail<'a>) -> Self
Create a new default AttachmentConfig with a thumbnail.
Arguments
thumbnail- The thumbnail of the media. If thecontent_typedoes not support it (eg audio clips), it is ignored.
To generate automatically a thumbnail from an image, use
AttachmentConfig::new() and
AttachmentConfig::generate_thumbnail().
sourcepub fn txn_id(self, txn_id: &'a TransactionId) -> Self
pub fn txn_id(self, txn_id: &'a TransactionId) -> Self
Set the transaction ID to send.
Arguments
txn_id- A unique ID that can be attached to aMessageEventheld in its unsigned field astransaction_id. If not given, one is created for the message.
sourcepub fn info(self, info: AttachmentInfo) -> Self
pub fn info(self, info: AttachmentInfo) -> Self
Set the media metadata to send.
Arguments
info- The metadata of the media. If theAttachmentInfotype doesn’t match thecontent_type, it is ignored.
Trait Implementations
sourceimpl<'a> Debug for AttachmentConfig<'a>
impl<'a> Debug for AttachmentConfig<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for AttachmentConfig<'a>
impl<'a> Send for AttachmentConfig<'a>
impl<'a> Sync for AttachmentConfig<'a>
impl<'a> Unpin for AttachmentConfig<'a>
impl<'a> UnwindSafe for AttachmentConfig<'a>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more