diff options
| author | mat <github@matdoes.dev> | 2022-02-03 02:16:24 +0000 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-02-03 02:16:24 +0000 |
| commit | 4ff67d4917ce333232189e86aee09f2d82451fc6 (patch) | |
| tree | 07c8688f54084d8ebbade9b13ac22e7d50a91e64 /azalea-brigadier/src/tree/root_command_node.rs | |
| parent | 1b888881516c7553126e0c7fc2539d14b129e29e (diff) | |
| download | azalea-drasl-4ff67d4917ce333232189e86aee09f2d82451fc6.tar.xz | |
a
Diffstat (limited to 'azalea-brigadier/src/tree/root_command_node.rs')
| -rw-r--r-- | azalea-brigadier/src/tree/root_command_node.rs | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/azalea-brigadier/src/tree/root_command_node.rs b/azalea-brigadier/src/tree/root_command_node.rs index 0fcb8d97..6b8bc157 100644 --- a/azalea-brigadier/src/tree/root_command_node.rs +++ b/azalea-brigadier/src/tree/root_command_node.rs @@ -6,6 +6,7 @@ use super::{ use crate::{ arguments::argument_type::ArgumentType, builder::argument_builder::ArgumentBuilder, + command::Command, context::{command_context::CommandContext, command_context_builder::CommandContextBuilder}, exceptions::{ builtin_exceptions::BuiltInExceptions, command_syntax_exception::CommandSyntaxException, @@ -16,16 +17,24 @@ use crate::{ }; use std::{ any::Any, + collections::HashMap, fmt::{Debug, Display, Formatter}, }; -#[derive(Clone, Default, Debug)] -pub struct RootCommandNode<'a, S> { +#[derive(Default)] +pub struct RootCommandNode<S> { // Since Rust doesn't have extending, we put the struct this is extending as the "base" field - pub base: BaseCommandNode<'a, S>, + children: HashMap<String, Box<dyn CommandNodeTrait<S>>>, + literals: HashMap<String, LiteralCommandNode<S>>, + arguments: HashMap<String, ArgumentCommandNode<S>>, + pub requirement: Box<dyn Fn(&S) -> bool>, + redirect: Option<Box<dyn CommandNodeTrait<S>>>, + modifier: Option<Box<dyn RedirectModifier<S>>>, + forks: bool, + pub command: Option<Box<dyn Command<S>>>, } -impl<S> CommandNodeTrait<S> for RootCommandNode<'_, S> { +impl<S> CommandNodeTrait<S> for RootCommandNode<S> { fn name(&self) -> &str { "" } @@ -63,7 +72,7 @@ impl<S> CommandNodeTrait<S> for RootCommandNode<'_, S> { } } -impl<S> Display for RootCommandNode<'_, S> { +impl<S> Display for RootCommandNode<S> { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "<root>") } |
