aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/context/command_context_builder.rs
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2023-05-05 19:37:40 +0000
committermat <github@matdoes.dev>2023-05-05 19:37:40 +0000
commite4176937f0584a6bcc5aba15abb1e2df6ddf588d (patch)
treee6db91c492702a66ebe45bc66553f23a547bd93e /azalea-brigadier/src/context/command_context_builder.rs
parentdf167a5a391ef2a9bf2290a24d99ef8f559d9084 (diff)
downloadazalea-drasl-e4176937f0584a6bcc5aba15abb1e2df6ddf588d.tar.xz
remove more unnecessary brigadier cloning!
Diffstat (limited to 'azalea-brigadier/src/context/command_context_builder.rs')
-rwxr-xr-xazalea-brigadier/src/context/command_context_builder.rs16
1 files changed, 8 insertions, 8 deletions
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<S> {
+pub struct CommandContextBuilder<'a, S> {
pub arguments: HashMap<String, ParsedArgument>,
pub root: Rc<RefCell<CommandNode<S>>>,
pub nodes: Vec<ParsedCommandNode<S>>,
- pub dispatcher: Rc<CommandDispatcher<S>>,
+ pub dispatcher: &'a CommandDispatcher<'a, S>,
pub source: Rc<S>,
pub command: Command<S>,
- pub child: Option<Rc<CommandContextBuilder<S>>>,
+ pub child: Option<Rc<CommandContextBuilder<'a, S>>>,
pub range: StringRange,
pub modifier: Option<Rc<RedirectModifier<S>>>,
pub forks: bool,
}
-impl<S> Clone for CommandContextBuilder<S> {
+impl<S> Clone for CommandContextBuilder<'_, S> {
fn clone(&self) -> Self {
Self {
arguments: self.arguments.clone(),
@@ -39,9 +39,9 @@ impl<S> Clone for CommandContextBuilder<S> {
}
}
-impl<S> CommandContextBuilder<S> {
+impl<'a, S> CommandContextBuilder<'a, S> {
pub fn new(
- dispatcher: Rc<CommandDispatcher<S>>,
+ dispatcher: &'a CommandDispatcher<S>,
source: Rc<S>,
root_node: Rc<RefCell<CommandNode<S>>>,
start: usize,
@@ -64,7 +64,7 @@ impl<S> CommandContextBuilder<S> {
self.command = command.clone();
self
}
- pub fn with_child(&mut self, child: Rc<CommandContextBuilder<S>>) -> &Self {
+ pub fn with_child(&mut self, child: Rc<CommandContextBuilder<'a, S>>) -> &Self {
self.child = Some(child);
self
}
@@ -99,7 +99,7 @@ impl<S> CommandContextBuilder<S> {
}
}
-impl<S> Debug for CommandContextBuilder<S> {
+impl<S> Debug for CommandContextBuilder<'_, S> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("CommandContextBuilder")
// .field("arguments", &self.arguments)