pub struct CommandCatalog { /* private fields */ }Expand description
Canonical registry/catalog of available command descriptors.
Implementations§
Source§impl CommandCatalog
impl CommandCatalog
Sourcepub fn register(
&mut self,
descriptor: CommandDescriptor,
) -> Result<(), ContractError>
pub fn register( &mut self, descriptor: CommandDescriptor, ) -> Result<(), ContractError>
Register a command descriptor. Rejects duplicate IDs and invalid schemas.
Sourcepub fn register_alias(
&mut self,
alias: impl Into<String>,
target: &CommandId,
) -> Result<(), ContractError>
pub fn register_alias( &mut self, alias: impl Into<String>, target: &CommandId, ) -> Result<(), ContractError>
Register an alias pointing to a registered command ID. Rejects duplicate aliases.
Sourcepub fn get(&self, id: &CommandId) -> Option<&CommandDescriptor>
pub fn get(&self, id: &CommandId) -> Option<&CommandDescriptor>
Lookup a descriptor by its exact command ID.
Sourcepub fn resolve(&self, alias_or_id: &str) -> Option<&CommandDescriptor>
pub fn resolve(&self, alias_or_id: &str) -> Option<&CommandDescriptor>
Resolve an alias or direct command ID to its descriptor.
Sourcepub fn descriptors(&self) -> &[CommandDescriptor]
pub fn descriptors(&self) -> &[CommandDescriptor]
Returns a slice of all registered descriptors in insertion order.
Trait Implementations§
Source§impl Clone for CommandCatalog
impl Clone for CommandCatalog
Source§impl Debug for CommandCatalog
impl Debug for CommandCatalog
Source§impl Default for CommandCatalog
impl Default for CommandCatalog
Source§impl<'de> Deserialize<'de> for CommandCatalog
impl<'de> Deserialize<'de> for CommandCatalog
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for CommandCatalog
Source§impl PartialEq for CommandCatalog
impl PartialEq for CommandCatalog
Source§impl Serialize for CommandCatalog
impl Serialize for CommandCatalog
impl StructuralPartialEq for CommandCatalog
Auto Trait Implementations§
impl Freeze for CommandCatalog
impl RefUnwindSafe for CommandCatalog
impl Send for CommandCatalog
impl Sync for CommandCatalog
impl Unpin for CommandCatalog
impl UnsafeUnpin for CommandCatalog
impl UnwindSafe for CommandCatalog
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