pub struct SubCommandBuilder<T: Clone + Send + Sync> {
pub name: String,
pub name_localizations: Option<HashMap<String, String>>,
pub description: String,
pub description_localizations: Option<HashMap<String, String>>,
pub func: Option<fn(CommandContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>>,
pub options: Vec<CommandOption>,
}
Fields§
§name: String
§name_localizations: Option<HashMap<String, String>>
§description: String
§description_localizations: Option<HashMap<String, String>>
§func: Option<fn(CommandContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>>
§options: Vec<CommandOption>
Implementations§
Source§impl<T: Clone + Send + Sync> SubCommandBuilder<T>
impl<T: Clone + Send + Sync> SubCommandBuilder<T>
pub fn new(name: impl Into<String>, description: impl Into<String>) -> Self
pub fn handler( self, handler: fn(CommandContext<T>) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send>>, ) -> Self
pub fn description_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
pub fn option(self, option: impl Into<CommandOption>) -> Self
pub fn build(self) -> CommandOption
Trait Implementations§
Source§impl<T: Clone + Clone + Send + Sync> Clone for SubCommandBuilder<T>
impl<T: Clone + Clone + Send + Sync> Clone for SubCommandBuilder<T>
Source§fn clone(&self) -> SubCommandBuilder<T>
fn clone(&self) -> SubCommandBuilder<T>
Returns a duplicate 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<T: Clone + Send + Sync> From<SubCommandBuilder<T>> for CommandOption
impl<T: Clone + Send + Sync> From<SubCommandBuilder<T>> for CommandOption
Source§fn from(value: SubCommandBuilder<T>) -> Self
fn from(value: SubCommandBuilder<T>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> Freeze for SubCommandBuilder<T>
impl<T> RefUnwindSafe for SubCommandBuilder<T>
impl<T> Send for SubCommandBuilder<T>
impl<T> Sync for SubCommandBuilder<T>
impl<T> Unpin for SubCommandBuilder<T>
impl<T> UnwindSafe for SubCommandBuilder<T>
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