From 4ff67d4917ce333232189e86aee09f2d82451fc6 Mon Sep 17 00:00:00 2001 From: mat Date: Thu, 3 Feb 2022 02:16:24 +0000 Subject: a --- azalea-brigadier/src/tree/argument_command_node.rs | 24 +++++++++------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'azalea-brigadier/src/tree/argument_command_node.rs') diff --git a/azalea-brigadier/src/tree/argument_command_node.rs b/azalea-brigadier/src/tree/argument_command_node.rs index 0997ec17..9d2af14e 100644 --- a/azalea-brigadier/src/tree/argument_command_node.rs +++ b/azalea-brigadier/src/tree/argument_command_node.rs @@ -31,18 +31,14 @@ use super::{ const USAGE_ARGUMENT_OPEN: &str = "<"; const USAGE_ARGUMENT_CLOSE: &str = ">"; -#[derive(Clone, Debug)] -pub struct ArgumentCommandNode<'a, S> { +pub struct ArgumentCommandNode { name: String, type_: Box>, - custom_suggestions: Option<&'a dyn SuggestionProvider>, - // custom_suggestions: &'a dyn SuggestionProvider, - // Since Rust doesn't have extending, we put the struct this is extending as the "base" field - pub base: BaseCommandNode<'a, S>, + custom_suggestions: Option>>, children: HashMap>>, - literals: HashMap>, - arguments: HashMap>, + literals: HashMap>, + arguments: HashMap>, pub requirement: Box bool>, redirect: Option>>, modifier: Option>>, @@ -50,17 +46,17 @@ pub struct ArgumentCommandNode<'a, S> { pub command: Option>>, } -impl ArgumentCommandNode<'_, S> { +impl ArgumentCommandNode { fn get_type(&self) -> &dyn ArgumentType { - self.type_ + &*self.type_ } - fn custom_suggestions(&self) -> Option<&dyn SuggestionProvider> { - self.custom_suggestions + fn custom_suggestions(&self) -> &Option>> { + &self.custom_suggestions } } -impl<'a, S> CommandNodeTrait for ArgumentCommandNode<'a, S> { +impl CommandNodeTrait for ArgumentCommandNode { fn name(&self) -> &str { &self.name } @@ -173,7 +169,7 @@ impl<'a, S> CommandNodeTrait for ArgumentCommandNode<'a, S> { } } -impl Display for ArgumentCommandNode<'_, S> { +impl Display for ArgumentCommandNode { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "", self.name, self.type_) } -- cgit v1.2.3