Struct twilight_util::builder::command::NumberBuilder
source · [−]pub struct NumberBuilder(_);builder only.Expand description
Create a number option with a builder.
Implementations
sourceimpl 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 fn build(self) -> CommandOption
pub fn build(self) -> CommandOption
Consume the builder, returning the built command option.
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
Set localization for a particular choice, by name.
Choices must be set with the choices method before updating their
localization.
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 value permitted.
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 value permitted.
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
sourceimpl Clone for NumberBuilder
impl Clone for NumberBuilder
sourcefn clone(&self) -> NumberBuilder
fn clone(&self) -> NumberBuilder
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more