pub struct NumberBuilder(/* private fields */);
Available on crate feature
builder
only.Expand description
Create a number option with a builder.
Implementations§
Source§impl NumberBuilder
impl NumberBuilder
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 NumberBuilder
.
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>>(
self,
choices: impl IntoIterator<Item = (K, f64)>,
) -> Self
pub fn choices<K: Into<String>>( self, choices: impl IntoIterator<Item = (K, f64)>, ) -> Self
Set the list of choices for an option.
Accepts tuples of (String, f64)
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_value(self, value: f64) -> Self
pub const fn max_value(self, value: f64) -> Self
Set the maximum allowed value.
Defaults to no limit.
Sourcepub const fn min_value(self, value: f64) -> Self
pub const fn min_value(self, value: f64) -> Self
Set the minimum allowed value.
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 NumberBuilder
impl Clone for NumberBuilder
Source§fn clone(&self) -> NumberBuilder
fn clone(&self) -> NumberBuilder
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 NumberBuilder
impl Debug for NumberBuilder
Source§impl From<NumberBuilder> for CommandOption
impl From<NumberBuilder> for CommandOption
Source§fn from(builder: NumberBuilder) -> CommandOption
fn from(builder: NumberBuilder) -> CommandOption
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for NumberBuilder
impl RefUnwindSafe for NumberBuilder
impl Send for NumberBuilder
impl Sync for NumberBuilder
impl Unpin for NumberBuilder
impl UnwindSafe for NumberBuilder
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