#[non_exhaustive]pub struct TextInput {
pub id: Option<i32>,
pub custom_id: CompactString,
pub style: TextInputStyle,
pub label: Option<CompactString>,
pub min_length: Option<u16>,
pub max_length: Option<u16>,
pub required: bool,
pub value: Option<CompactString>,
pub placeholder: Option<CompactString>,
}Expand description
A text input in a modal (inside a label).
discord.js counterpart: TextInputComponent / TextInputBuilder.
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.id: Option<i32>The component’s numeric identifier (generated by Discord when not set).
custom_id: CompactStringThe developer-defined identifier (1-100 characters).
style: TextInputStyleSingle-line or multi-line.
label: Option<CompactString>The label above the input. Deprecated by Discord: put the input in a
Label instead.
min_length: Option<u16>The minimum length (0-4000).
max_length: Option<u16>The maximum length (1-4000).
required: boolWhether the input must be filled (default true).
value: Option<CompactString>The pre-filled value (max 4000 characters).
placeholder: Option<CompactString>The text shown when the input is empty (max 100 characters).
Implementations§
Source§impl TextInput
impl TextInput
Sourcepub fn new(custom_id: impl Into<CompactString>, style: TextInputStyle) -> Self
pub fn new(custom_id: impl Into<CompactString>, style: TextInputStyle) -> Self
Creates a required text input.
discord.js counterpart: TextInputBuilder (@discordjs/builders).
Trait Implementations§
impl Eq for TextInput
impl StructuralPartialEq for TextInput
Auto Trait Implementations§
impl Forget for TextInput
impl Freeze for TextInput
impl Move for TextInput
impl RefUnwindSafe for TextInput
impl Send for TextInput
impl Sync for TextInput
impl Unpin for TextInput
impl UnsafeUnpin for TextInput
impl UnwindSafe for TextInput
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