aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/tree/root_command_node.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-02-01 00:12:46 -0600
committermat <github@matdoes.dev>2022-02-01 00:12:46 -0600
commitd9e52f8d965473517ddf6f11f9ac3be9aa14e14d (patch)
treed29b0e3184df0973ba07927a572814e4594f9e9e /azalea-brigadier/src/tree/root_command_node.rs
parent30a86e1de5d8bf302f05d091b0a7b4cc6721d911 (diff)
downloadazalea-drasl-d9e52f8d965473517ddf6f11f9ac3be9aa14e14d.tar.xz
b
Diffstat (limited to 'azalea-brigadier/src/tree/root_command_node.rs')
-rw-r--r--azalea-brigadier/src/tree/root_command_node.rs31
1 files changed, 18 insertions, 13 deletions
diff --git a/azalea-brigadier/src/tree/root_command_node.rs b/azalea-brigadier/src/tree/root_command_node.rs
index c3139a05..0fcb8d97 100644
--- a/azalea-brigadier/src/tree/root_command_node.rs
+++ b/azalea-brigadier/src/tree/root_command_node.rs
@@ -1,44 +1,49 @@
-use std::fmt::{Display, Formatter};
-
+use super::{
+ argument_command_node::ArgumentCommandNode,
+ command_node::{BaseCommandNode, CommandNodeTrait},
+ literal_command_node::LiteralCommandNode,
+};
use crate::{
arguments::argument_type::ArgumentType,
+ builder::argument_builder::ArgumentBuilder,
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,
+ fmt::{Debug, Display, Formatter},
+};
-use super::command_node::{BaseCommandNode, CommandNode};
-
-#[derive(Clone, Default)]
+#[derive(Clone, Default, Debug)]
pub struct RootCommandNode<'a, S> {
// Since Rust doesn't have extending, we put the struct this is extending as the "base" field
pub base: BaseCommandNode<'a, S>,
}
-impl<S> CommandNode<S> for RootCommandNode<'_, S>
-where
- S: Clone,
-{
+impl<S> CommandNodeTrait<S> for RootCommandNode<'_, S> {
fn name(&self) -> &str {
""
}
fn parse(
&self,
- reader: StringReader,
+ reader: &mut StringReader<'_>,
context_builder: CommandContextBuilder<S>,
) -> Result<(), CommandSyntaxException> {
+ Ok(())
}
fn list_suggestions(
&self,
context: CommandContext<S>,
- builder: SuggestionsBuilder,
+ builder: &SuggestionsBuilder,
) -> Result<Suggestions, CommandSyntaxException> {
- Suggestions::empty()
+ Ok(Suggestions::default())
}
fn is_valid_input(&self, input: &str) -> bool {
@@ -49,7 +54,7 @@ where
""
}
- fn create_builder(&self) -> () {
+ fn create_builder(&self) -> Box<dyn ArgumentBuilder<S>> {
panic!("Cannot convert root into a builder");
}