aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/tree/root_command_node.rs
diff options
context:
space:
mode:
authorUbuntu <github@matdoes.dev>2022-01-12 00:40:43 +0000
committerUbuntu <github@matdoes.dev>2022-01-12 00:40:43 +0000
commit270507736af57aae6801dc9eb3c3132139d0d07b (patch)
treea8fa1d1b8d038eb9d7e2061342026d23ddbd9027 /azalea-brigadier/src/tree/root_command_node.rs
parentcc4fe62fc82842e0bde628437a45d55c6a82f1f3 (diff)
downloadazalea-drasl-270507736af57aae6801dc9eb3c3132139d0d07b.tar.xz
a
Diffstat (limited to 'azalea-brigadier/src/tree/root_command_node.rs')
-rw-r--r--azalea-brigadier/src/tree/root_command_node.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/azalea-brigadier/src/tree/root_command_node.rs b/azalea-brigadier/src/tree/root_command_node.rs
index 36787340..ded5fa77 100644
--- a/azalea-brigadier/src/tree/root_command_node.rs
+++ b/azalea-brigadier/src/tree/root_command_node.rs
@@ -1,6 +1,7 @@
use std::fmt::{Display, Formatter};
use crate::{
+ arguments::argument_type::{ArgumentType, Types},
context::{command_context::CommandContext, command_context_builder::CommandContextBuilder},
exceptions::{
builtin_exceptions::BuiltInExceptions, command_syntax_exception::CommandSyntaxException,
@@ -11,12 +12,21 @@ use crate::{
use super::command_node::{BaseCommandNode, CommandNode};
-pub struct RootCommandNode<'a, S, T> {
+#[derive(Clone, Default)]
+pub struct RootCommandNode<'a, S, T>
+where
+ // each argument command node has its own different type
+ T: ArgumentType<dyn Types>,
+{
// Since Rust doesn't have extending, we put the struct this is extending as the "base" field
pub base: BaseCommandNode<'a, S, T>,
}
-impl<S, T> CommandNode<S, T> for RootCommandNode<'_, S, T> {
+impl<S, T> CommandNode<S, T> for RootCommandNode<'_, S, T>
+where
+ T: ArgumentType<dyn Types> + Clone,
+ S: Clone,
+{
fn name(&self) -> &str {
""
}
@@ -53,7 +63,10 @@ impl<S, T> CommandNode<S, T> for RootCommandNode<'_, S, T> {
}
}
-impl<S, T> Display for RootCommandNode<'_, S, T> {
+impl<S, T> Display for RootCommandNode<'_, S, T>
+where
+ T: ArgumentType<dyn Types>,
+{
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "<root>")
}