Enum twilight_model::gateway::presence::activity_button::ActivityButton [−][src]
pub enum ActivityButton {
Link(ActivityButtonLink),
Text(ActivityButtonText),
}Expand description
Button used in an activity.
serde
Activity buttons with a URL deserialize and serialize as a struct:
use twilight_model::gateway::presence::activity_button::{ ActivityButtonLink, ActivityButton, }; const JSON: &str = r#"{ "label": "a", "url": "b" }"#; assert_eq!( ActivityButton::Link(ActivityButtonLink { label: "a".to_owned(), url: "b".to_owned(), }), serde_json::from_str(JSON)?, );
An activity button without a URL - an ActivityButtonText - will
deserialize and serialize as a string. This means that a textual activity
button with a label of “test” will serialize as simply the string “test” and
vice versa.
use twilight_model::gateway::presence::activity_button::{ ActivityButtonText, ActivityButton, }; assert_eq!( ActivityButton::Text(ActivityButtonText { label: "test".to_owned(), }), serde_json::from_str(r#""test""#)?, );
Variants
Link(ActivityButtonLink)Activity button is a link.
Text(ActivityButtonText)Activity button is textual.
Implementations
Trait Implementations
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 ==. Read more
This method tests for !=.
Auto Trait Implementations
impl RefUnwindSafe for ActivityButtonimpl Send for ActivityButtonimpl Sync for ActivityButtonimpl Unpin for ActivityButtonimpl UnwindSafe for ActivityButtonBlanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span, returning an
Instrumented wrapper. Read more