pub struct AttachmentConfig<'a> { /* private fields */ }
Expand description

Configuration for sending an attachment.

Implementations

Create a new default AttachmentConfig without providing a thumbnail.

To provide a thumbnail use AttachmentConfig::with_thumbnail().

Available on crate feature 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 to None, defaults to (800, 600).

Create a new default AttachmentConfig with a thumbnail.

Arguments
  • thumbnail - The thumbnail of the media. If the content_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().

Set the transaction ID to send.

Arguments
  • txn_id - A unique ID that can be attached to a MessageEvent held in its unsigned field as transaction_id. If not given, one is created for the message.

Set the media metadata to send.

Arguments
  • info - The metadata of the media. If the AttachmentInfo type doesn’t match the content_type, it is ignored.

Trait Implementations

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more