Struct teloxide::types::Sticker

source ·
pub struct Sticker {
    pub file: FileMeta,
    pub width: u16,
    pub height: u16,
    pub kind: StickerKind,
    pub format: StickerFormat,
    pub thumb: Option<PhotoSize>,
    pub emoji: Option<String>,
    pub set_name: Option<String>,
}
Expand description

This object represents a sticker.

The official docs.

Fields§

§file: FileMeta

Metadata of the sticker file.

§width: u16

Sticker width, in pixels.

You can assume that max(width, height) = 512, min(width, height) <= 512. In other words one dimension is exactly 512 pixels and the other is at most 512 pixels.

§height: u16

Sticker height, in pixels.

You can assume that max(width, height) = 512, min(width, height) <= 512. In other words one dimension is exactly 512 pixels and the other is at most 512 pixels.

§kind: StickerKind

Kind of this sticker - regular, mask or custom emoji.

In other words this represent how the sticker is presented, as a big picture/video, as a mask while editing pictures or as a custom emoji in messages.

§format: StickerFormat

Format of this sticker - raster/.webp, animated/.tgs or video/.webm.

In other words this represents how the sticker is encoded.

§thumb: Option<PhotoSize>

Sticker thumbnail in the .webp or .jpg format.

§emoji: Option<String>

Emoji associated with the sticker.

§set_name: Option<String>

Name of the sticker set to which the sticker belongs.

Implementations§

Returns true is this is a “normal” raster sticker.

Alias to self.format.is_raster().

Returns true is this is an animated sticker.

Alias to self.format.is_animated().

Returns true is this is a video sticker.

Alias to self.format.is_video().

Methods from Deref<Target = StickerKind>§

Returns true if the sticker kind is Regular.

Returns true if the sticker kind is Mask.

Returns true if the sticker kind is CustomEmoji.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

This allows calling StickerKind’s methods directly on Sticker.

use teloxide_core::types::Sticker;

let sticker: Sticker = todo!();

let _ = sticker.is_regular();
let _ = sticker.kind.is_regular();

let _ = sticker.mask_position();
let _ = sticker.kind.mask_position();
The resulting type after dereferencing.
Dereferences the value.
Deserialize this value from the given Serde deserializer. Read more
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Serialize this value into the given Serde serializer. 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
Unerase this erased pointer. Read more
Available on non-enforce_1_1_0_semantics only.
Whether this implementor has acknowledged the 1.1.0 update to unerase’s documented implementation requirements. Read more
Turn this erasable pointer into an erased pointer. Read more

Returns the argument unchanged.

Converts to this type from a reference to the input type.
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 resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
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