Struct matrix_sdk::attachment::AttachmentConfig
source · pub struct AttachmentConfig { /* private fields */ }
Expand description
Configuration for sending an attachment.
Implementations§
source§impl AttachmentConfig
impl AttachmentConfig
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)>,
format: ThumbnailFormat,
) -> Self
Available on crate feature image-proc
only.
pub fn generate_thumbnail( self, size: Option<(u32, u32)>, format: ThumbnailFormat, ) -> 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.
If generating the thumbnail failed, the error will be logged and sending the attachment will proceed without a thumbnail.
§Arguments
-
size
- The size of the thumbnail in pixels as a(width, height)
tuple. If set toNone
, defaults to(800, 600)
. -
format
- The image format to use to encode the thumbnail.
sourcepub fn with_thumbnail(thumbnail: Thumbnail) -> Self
pub fn with_thumbnail(thumbnail: Thumbnail) -> Self
Create a new default AttachmentConfig
with a thumbnail
.
§Arguments
thumbnail
- The thumbnail of the media. If thecontent_type
does 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: &TransactionId) -> Self
pub fn txn_id(self, txn_id: &TransactionId) -> Self
Set the transaction ID to send.
§Arguments
txn_id
- A unique ID that can be attached to aMessageEvent
held 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 theAttachmentInfo
type doesn’t match thecontent_type
, it is ignored.
Trait Implementations§
source§impl Debug for AttachmentConfig
impl Debug for AttachmentConfig
source§impl Default for AttachmentConfig
impl Default for AttachmentConfig
source§fn default() -> AttachmentConfig
fn default() -> AttachmentConfig
Auto Trait Implementations§
impl Freeze for AttachmentConfig
impl RefUnwindSafe for AttachmentConfig
impl Send for AttachmentConfig
impl Sync for AttachmentConfig
impl Unpin for AttachmentConfig
impl UnwindSafe for AttachmentConfig
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.