pub struct StringBuilder(/* private fields */);
Available on crate feature
builder
only.Expand description
Create a string option with a builder.
Implementations§
Source§impl StringBuilder
impl StringBuilder
Sourcepub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
Create a new default StringBuilder
.
Sourcepub const fn autocomplete(self, autocomplete: bool) -> Self
pub const fn autocomplete(self, autocomplete: bool) -> Self
Set whether this option supports autocomplete.
Defaults to false
.
Sourcepub fn choice_localizations<K: Into<String>, V: Into<String>>(
self,
choice_name: &str,
name_localizations: impl IntoIterator<Item = (K, V)>,
) -> Self
pub fn choice_localizations<K: Into<String>, V: Into<String>>( self, choice_name: &str, name_localizations: impl IntoIterator<Item = (K, V)>, ) -> Self
Sourcepub fn choices<K: Into<String>, V: Into<String>>(
self,
choices: impl IntoIterator<Item = (K, V)>,
) -> Self
pub fn choices<K: Into<String>, V: Into<String>>( self, choices: impl IntoIterator<Item = (K, V)>, ) -> Self
Set the list of choices for an option.
Accepts tuples of (String, String)
corresponding to the name and
value. Localization may be added with choice_localizations
.
Defaults to no choices.
Sourcepub fn description_localizations<K: Into<String>, V: Into<String>>(
self,
localizations: impl IntoIterator<Item = (K, V)>,
) -> Self
pub fn description_localizations<K: Into<String>, V: Into<String>>( self, localizations: impl IntoIterator<Item = (K, V)>, ) -> Self
Set the localization dictionary for the option description.
Defaults to None
.
Sourcepub const fn max_length(self, value: u16) -> Self
pub const fn max_length(self, value: u16) -> Self
Set the maximum allowed length.
Defaults to no limit.
Sourcepub const fn min_length(self, value: u16) -> Self
pub const fn min_length(self, value: u16) -> Self
Set the minimum allowed length.
Defaults to no limit.
Sourcepub fn name_localizations<K: Into<String>, V: Into<String>>(
self,
localizations: impl IntoIterator<Item = (K, V)>,
) -> Self
pub fn name_localizations<K: Into<String>, V: Into<String>>( self, localizations: impl IntoIterator<Item = (K, V)>, ) -> Self
Set the localization dictionary for the option name.
Defaults to None
.
Trait Implementations§
Source§impl Clone for StringBuilder
impl Clone for StringBuilder
Source§fn clone(&self) -> StringBuilder
fn clone(&self) -> StringBuilder
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 StringBuilder
impl Debug for StringBuilder
Source§impl From<StringBuilder> for CommandOption
impl From<StringBuilder> for CommandOption
Source§fn from(builder: StringBuilder) -> CommandOption
fn from(builder: StringBuilder) -> CommandOption
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for StringBuilder
impl RefUnwindSafe for StringBuilder
impl Send for StringBuilder
impl Sync for StringBuilder
impl Unpin for StringBuilder
impl UnwindSafe for StringBuilder
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