From e4176937f0584a6bcc5aba15abb1e2df6ddf588d Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 5 May 2023 19:37:40 +0000 Subject: remove more unnecessary brigadier cloning! --- azalea-brigadier/src/context/command_context_builder.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'azalea-brigadier/src/context/command_context_builder.rs') diff --git a/azalea-brigadier/src/context/command_context_builder.rs b/azalea-brigadier/src/context/command_context_builder.rs index 7516ab9e..b0677158 100755 --- a/azalea-brigadier/src/context/command_context_builder.rs +++ b/azalea-brigadier/src/context/command_context_builder.rs @@ -9,20 +9,20 @@ use crate::{ }; use std::{cell::RefCell, collections::HashMap, fmt::Debug, rc::Rc}; -pub struct CommandContextBuilder { +pub struct CommandContextBuilder<'a, S> { pub arguments: HashMap, pub root: Rc>>, pub nodes: Vec>, - pub dispatcher: Rc>, + pub dispatcher: &'a CommandDispatcher<'a, S>, pub source: Rc, pub command: Command, - pub child: Option>>, + pub child: Option>>, pub range: StringRange, pub modifier: Option>>, pub forks: bool, } -impl Clone for CommandContextBuilder { +impl Clone for CommandContextBuilder<'_, S> { fn clone(&self) -> Self { Self { arguments: self.arguments.clone(), @@ -39,9 +39,9 @@ impl Clone for CommandContextBuilder { } } -impl CommandContextBuilder { +impl<'a, S> CommandContextBuilder<'a, S> { pub fn new( - dispatcher: Rc>, + dispatcher: &'a CommandDispatcher, source: Rc, root_node: Rc>>, start: usize, @@ -64,7 +64,7 @@ impl CommandContextBuilder { self.command = command.clone(); self } - pub fn with_child(&mut self, child: Rc>) -> &Self { + pub fn with_child(&mut self, child: Rc>) -> &Self { self.child = Some(child); self } @@ -99,7 +99,7 @@ impl CommandContextBuilder { } } -impl Debug for CommandContextBuilder { +impl Debug for CommandContextBuilder<'_, S> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("CommandContextBuilder") // .field("arguments", &self.arguments) -- cgit v1.2.3