Enum twilight_http::request::channel::reaction::RequestReactionType[][src]

pub enum RequestReactionType {
    Custom {
        id: EmojiId,
        name: Option<String>,
    },
    Unicode {
        name: String,
    },
}
Expand description

Handle a reaction of either a custom or unicode emoji.

Variants

Custom

Reaction of a custom emoji.

Show fields

Fields of Custom

id: EmojiId

ID of the custom emoji.

name: Option<String>

Name of the custom emoji.

This is not strictly required, but may be helpful for Discord to work with.

Unicode

Reaction of a unicode emoji, such as “🌈”.

Show fields

Fields of Unicode

name: String

Unicode emoji.

Implementations

Create a display formatter for a reaction type resulting in a format acceptable for use in URLs.

Examples

Format the transgender flag for use in a URL:

use twilight_http::request::channel::reaction::RequestReactionType;
use twilight_model::id::EmojiId;

let reaction = RequestReactionType::Unicode {
    name: "🏳️‍⚧️".to_owned(),
};

// Retrieve the display formatter.
let display = reaction.display();

// And now format it into a percent-encoded string and then check it.
assert_eq!(
    "%F0%9F%8F%B3%EF%B8%8F%E2%80%8D%E2%9A%A7%EF%B8%8F",
    display.to_string(),
);

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

Performs the conversion.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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

Compare self to key and return true if they are equal.

Performs the conversion.

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

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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.