pub enum ActivityButton {
Link(ActivityButtonLink),
Text(ActivityButtonText),
Unknown,
}
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::{ActivityButton, ActivityButtonLink};
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::{ActivityButton, ActivityButtonText};
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.
Unknown
Variant value is unknown to the library.
Implementations§
Trait Implementations§
source§impl Clone for ActivityButton
impl Clone for ActivityButton
source§fn clone(&self) -> ActivityButton
fn clone(&self) -> ActivityButton
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ActivityButton
impl Debug for ActivityButton
source§impl<'de> Deserialize<'de> for ActivityButton
impl<'de> Deserialize<'de> for ActivityButton
source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for ActivityButton
impl Hash for ActivityButton
source§impl PartialEq for ActivityButton
impl PartialEq for ActivityButton
source§impl Serialize for ActivityButton
impl Serialize for ActivityButton
impl Eq for ActivityButton
impl StructuralPartialEq for ActivityButton
Auto Trait Implementations§
impl Freeze for ActivityButton
impl RefUnwindSafe for ActivityButton
impl Send for ActivityButton
impl Sync for ActivityButton
impl Unpin for ActivityButton
impl UnwindSafe for ActivityButton
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)