diff options
| author | mat <github@matdoes.dev> | 2022-04-17 14:02:13 -0500 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2022-04-17 14:02:13 -0500 |
| commit | a72a47ced76065caf739898954cd18edbc39174b (patch) | |
| tree | 5526c7663f253bbd7c8318b9d98413f1f2074852 /azalea-brigadier/src/tree/root_command_node.rs | |
| parent | 4ff67d4917ce333232189e86aee09f2d82451fc6 (diff) | |
| download | azalea-drasl-a72a47ced76065caf739898954cd18edbc39174b.tar.xz | |
Rewrite brigadier
Diffstat (limited to 'azalea-brigadier/src/tree/root_command_node.rs')
| -rw-r--r-- | azalea-brigadier/src/tree/root_command_node.rs | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/azalea-brigadier/src/tree/root_command_node.rs b/azalea-brigadier/src/tree/root_command_node.rs deleted file mode 100644 index 6b8bc157..00000000 --- a/azalea-brigadier/src/tree/root_command_node.rs +++ /dev/null @@ -1,79 +0,0 @@ -use super::{ - argument_command_node::ArgumentCommandNode, - command_node::{BaseCommandNode, CommandNodeTrait}, - literal_command_node::LiteralCommandNode, -}; -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, - }, - redirect_modifier::RedirectModifier, - string_reader::StringReader, - suggestion::{suggestions::Suggestions, suggestions_builder::SuggestionsBuilder}, -}; -use std::{ - any::Any, - collections::HashMap, - fmt::{Debug, Display, Formatter}, -}; - -#[derive(Default)] -pub struct RootCommandNode<S> { - // Since Rust doesn't have extending, we put the struct this is extending as the "base" field - 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> { - fn name(&self) -> &str { - "" - } - - fn parse( - &self, - reader: &mut StringReader<'_>, - context_builder: CommandContextBuilder<S>, - ) -> Result<(), CommandSyntaxException> { - Ok(()) - } - - fn list_suggestions( - &self, - context: CommandContext<S>, - builder: &SuggestionsBuilder, - ) -> Result<Suggestions, CommandSyntaxException> { - Ok(Suggestions::default()) - } - - fn is_valid_input(&self, input: &str) -> bool { - false - } - - fn usage_text(&self) -> &str { - "" - } - - fn create_builder(&self) -> Box<dyn ArgumentBuilder<S>> { - panic!("Cannot convert root into a builder"); - } - - fn get_examples(&self) -> Vec<String> { - vec![] - } -} - -impl<S> Display for RootCommandNode<S> { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - write!(f, "<root>") - } -} |
