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