Enum twilight_model::application::component::Component
source · [−]pub enum Component {
ActionRow(ActionRow),
Button(Button),
SelectMenu(SelectMenu),
TextInput(TextInput),
Unknown(u8),
}
Expand description
Interactive element of a message that an application uses.
Refer to Discord Docs/Message Components for additional information.
Variants
ActionRow(ActionRow)
Button(Button)
SelectMenu(SelectMenu)
TextInput(TextInput)
Unknown(u8)
Implementations
sourceimpl Component
impl Component
sourcepub const fn kind(&self) -> ComponentType
pub const fn kind(&self) -> ComponentType
Type of component that this is.
use twilight_model::application::component::{
button::{Button, ButtonStyle},
Component, ComponentType,
};
let component = Component::Button(Button {
custom_id: None,
disabled: false,
emoji: None,
label: Some("ping".to_owned()),
style: ButtonStyle::Primary,
url: None,
});
assert_eq!(ComponentType::Button, component.kind());
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Component
impl<'de> Deserialize<'de> for Component
sourcefn 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
sourceimpl From<SelectMenu> for Component
impl From<SelectMenu> for Component
sourcefn from(select_menu: SelectMenu) -> Self
fn from(select_menu: SelectMenu) -> Self
Converts to this type from the input type.
impl Eq for Component
impl StructuralEq for Component
impl StructuralPartialEq for Component
Auto Trait Implementations
impl RefUnwindSafe for Component
impl Send for Component
impl Sync for Component
impl Unpin for Component
impl UnwindSafe for Component
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more