kal 0.5.0

Command Abstraction Layer
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::{CommandFragment, CommandParseError, CommandSpec};

/// The command
pub trait Command: Sized {
    /// The name of command
    const NAME: &'static str;

    /// The spec of command for command registration.
    fn spec() -> CommandSpec;

    /// Try parse command from [`CommandFragment`] sequence.
    fn parse(fragments: &[CommandFragment]) -> Result<Self, CommandParseError>;
}