#[non_exhaustive]pub struct CommandDefinition {
pub name: String,
pub description: Option<String>,
pub handler: Arc<dyn CommandHandler>,
}Expand description
Definition of a slash command registered with the session.
When the CLI is running with a TUI, registered commands appear as
/name for the user to invoke. Only name and description are sent
over the wire — the handler is local to this SDK process.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: StringCommand name (without leading /).
description: Option<String>Human-readable description shown in command-completion UI.
handler: Arc<dyn CommandHandler>Handler invoked when the command is executed.
Implementations§
Source§impl CommandDefinition
impl CommandDefinition
Sourcepub fn new(name: impl Into<String>, handler: Arc<dyn CommandHandler>) -> Self
pub fn new(name: impl Into<String>, handler: Arc<dyn CommandHandler>) -> Self
Construct a new command definition. Use with_description
to add a description.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the human-readable description shown in the CLI’s command-completion UI.
Trait Implementations§
Source§impl Clone for CommandDefinition
impl Clone for CommandDefinition
Source§fn clone(&self) -> CommandDefinition
fn clone(&self) -> CommandDefinition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 CommandDefinition
impl Debug for CommandDefinition
Auto Trait Implementations§
impl Freeze for CommandDefinition
impl !RefUnwindSafe for CommandDefinition
impl Send for CommandDefinition
impl Sync for CommandDefinition
impl Unpin for CommandDefinition
impl UnsafeUnpin for CommandDefinition
impl !UnwindSafe for CommandDefinition
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