Skip to main content

CommandArgumentParser

Trait CommandArgumentParser 

Source
pub trait CommandArgumentParser:
    DowncastType
    + Debug
    + PartialEq
    + Send
    + Sync
    + 'static {
    type Value: DowncastType + Debug + Send + Sync + 'static;

    // Required methods
    fn parse(
        &self,
        reader: &mut CommandReader<'_, '_>,
        source: CommandParserSource<'_>,
    ) -> Result<Self::Value, CommandError>;
    fn protocol_argument(
        &self,
    ) -> (ProtocolArgumentType, Option<ProtocolSuggestionType>);

    // Provided method
    fn list_suggestions(
        &self,
        _context: CommandSuggestionContext<'_>,
        _suggestions: &mut CommandSuggestions<'_, '_>,
    ) { ... }
}
Expand description

Typed, deterministically keyed parser contract for extension arguments.

Required Associated Types§

Source

type Value: DowncastType + Debug + Send + Sync + 'static

Concrete keyed value retained in the parsed command context.

Required Methods§

Source

fn parse( &self, reader: &mut CommandReader<'_, '_>, source: CommandParserSource<'_>, ) -> Result<Self::Value, CommandError>

Parses one value from the reader’s current cursor.

Source

fn protocol_argument( &self, ) -> (ProtocolArgumentType, Option<ProtocolSuggestionType>)

Returns the vanilla command-tree parser and optional server suggestion provider.

Provided Methods§

Source

fn list_suggestions( &self, _context: CommandSuggestionContext<'_>, _suggestions: &mut CommandSuggestions<'_, '_>, )

Adds context-aware completions for a partially entered value.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§