steel_core/command/brigadier/
runtime.rs1use super::{
4 ArgumentType, CommandArgumentParser, CommandContext, CommandSyntaxError, PrimitiveArgumentValue,
5};
6
7pub(crate) trait CommandRuntime<S>: 'static {
9 type Argument: CommandArgumentParser<S, Value = Self::ArgumentValue>;
10 type ArgumentValue: Clone + Send + Sync + 'static;
11 type Executor: Send + Sync + ?Sized;
12 type Modifier: Send + Sync + ?Sized;
13}
14
15pub(crate) struct BrigadierRuntime;
17
18pub(super) type BrigadierExecutor<S> =
19 dyn Fn(&CommandContext<S, BrigadierRuntime>) -> Result<i32, CommandSyntaxError> + Send + Sync;
20pub(super) type BrigadierModifier<S> = dyn Fn(&CommandContext<S, BrigadierRuntime>) -> Result<Vec<S>, CommandSyntaxError>
21 + Send
22 + Sync;
23
24impl<S> CommandRuntime<S> for BrigadierRuntime {
25 type Argument = ArgumentType;
26 type ArgumentValue = PrimitiveArgumentValue;
27 type Executor = BrigadierExecutor<S>;
28 type Modifier = BrigadierModifier<S>;
29}