aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/tree/literal_command_node.rs
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-brigadier/src/tree/literal_command_node.rs')
-rw-r--r--azalea-brigadier/src/tree/literal_command_node.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/azalea-brigadier/src/tree/literal_command_node.rs b/azalea-brigadier/src/tree/literal_command_node.rs
index fe933669..021a3ea6 100644
--- a/azalea-brigadier/src/tree/literal_command_node.rs
+++ b/azalea-brigadier/src/tree/literal_command_node.rs
@@ -1,4 +1,5 @@
use crate::{
+ arguments::argument_type::{ArgumentType, Types},
builder::literal_argument_builder::LiteralArgumentBuilder,
command::Command,
context::{command_context::CommandContext, command_context_builder::CommandContextBuilder},
@@ -12,15 +13,22 @@ use crate::{
use super::command_node::{BaseCommandNode, CommandNode};
-#[derive(Hash, PartialEq, Eq, Debug, Clone)]
-pub struct LiteralCommandNode<'a, S, T> {
+#[derive(Debug, Clone)]
+pub struct LiteralCommandNode<'a, S, T>
+where
+ // each argument command node has its own different type
+ T: ArgumentType<dyn Types>,
+{
literal: String,
literal_lowercase: String,
// Since Rust doesn't have extending, we put the struct this is extending as the "base" field
pub base: BaseCommandNode<'a, S, T>,
}
-impl<'a, S, T> LiteralCommandNode<'a, S, T> {
+impl<'a, S, T> LiteralCommandNode<'a, S, T>
+where
+ T: ArgumentType<dyn Types>,
+{
pub fn new(literal: String, base: BaseCommandNode<S, T>) -> Self {
let literal_lowercase = literal.to_lowercase();
Self {
@@ -51,7 +59,11 @@ impl<'a, S, T> LiteralCommandNode<'a, S, T> {
}
}
-impl<S, T> CommandNode<S, T> for LiteralCommandNode<'_, S, T> {
+impl<S, T> CommandNode<S, T> for LiteralCommandNode<'_, S, T>
+where
+ T: ArgumentType<dyn Types> + Clone,
+ S: Clone,
+{
fn name(&self) -> &str {
&self.literal
}