#[non_exhaustive]pub struct AutocompleteCallbackData {
pub choices: AutocompleteChoices,
}Expand description
The data of an autocomplete response: the suggested choices.
discord.js counterpart: APICommandAutocompleteInteractionResponseCallbackData (discord-api-types).
§Examples
use djs_model::{
application_command::Choice,
interaction::{AutocompleteCallbackData, AutocompleteChoices, InteractionResponse},
};
let response = InteractionResponse::AutocompleteResult(AutocompleteCallbackData::new(
AutocompleteChoices::Integer(vec![Choice::new("Ten", 10), Choice::new("Twenty", 20)]),
));
assert_eq!(
serde_json::to_string(&response).unwrap(),
r#"{"type":8,"data":{"choices":[{"name":"Ten","value":10},{"name":"Twenty","value":20}]}}"#
);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.choices: AutocompleteChoicesThe choices (up to 25; empty for “no suggestions”).
Implementations§
Source§impl AutocompleteCallbackData
impl AutocompleteCallbackData
Sourcepub const fn new(choices: AutocompleteChoices) -> Self
pub const fn new(choices: AutocompleteChoices) -> Self
Creates the data.
discord.js counterpart: AutocompleteInteraction#respond.
Trait Implementations§
Source§impl Clone for AutocompleteCallbackData
impl Clone for AutocompleteCallbackData
Source§impl Debug for AutocompleteCallbackData
impl Debug for AutocompleteCallbackData
Source§impl PartialEq for AutocompleteCallbackData
impl PartialEq for AutocompleteCallbackData
Source§impl Serialize for AutocompleteCallbackData
impl Serialize for AutocompleteCallbackData
impl StructuralPartialEq for AutocompleteCallbackData
Auto Trait Implementations§
impl Freeze for AutocompleteCallbackData
impl RefUnwindSafe for AutocompleteCallbackData
impl Send for AutocompleteCallbackData
impl Sync for AutocompleteCallbackData
impl Unpin for AutocompleteCallbackData
impl UnsafeUnpin for AutocompleteCallbackData
impl UnwindSafe for AutocompleteCallbackData
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