From d9e52f8d965473517ddf6f11f9ac3be9aa14e14d Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 1 Feb 2022 00:12:46 -0600 Subject: b --- .../src/context/command_context_builder.rs | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 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 95da4064..969f9cfd 100644 --- a/azalea-brigadier/src/context/command_context_builder.rs +++ b/azalea-brigadier/src/context/command_context_builder.rs @@ -1,10 +1,10 @@ -use std::{any::Any, collections::HashMap}; - use crate::{ arguments::argument_type::ArgumentType, command::Command, command_dispatcher::CommandDispatcher, redirect_modifier::RedirectModifier, - tree::command_node::CommandNode, + tree::command_node::CommandNodeTrait, }; +use std::fmt::Debug; +use std::{any::Any, collections::HashMap}; use super::{ command_context::CommandContext, parsed_argument::ParsedArgument, @@ -27,12 +27,12 @@ use super::{ #[derive(Clone)] pub struct CommandContextBuilder<'a, S> { arguments: HashMap>>, - root_node: &'a dyn CommandNode, + root_node: &'a dyn CommandNodeTrait, nodes: Vec>, dispatcher: CommandDispatcher<'a, S>, source: S, command: Box>, - child: Option>, + child: Box>>, range: StringRange, modifier: Option>>, forks: bool, @@ -45,11 +45,14 @@ pub struct CommandContextBuilder<'a, S> { // this.range = StringRange.at(start); // } -impl CommandContextBuilder<'_, S> { +impl CommandContextBuilder<'_, S> +where + , +{ pub fn new( dispatcher: CommandDispatcher, source: S, - root_node: dyn CommandNode, + root_node: dyn CommandNodeTrait, start: usize, ) -> Self { Self { @@ -70,7 +73,7 @@ impl CommandContextBuilder<'_, S> { &self.source } - pub fn root_node(&self) -> &dyn CommandNode { + pub fn root_node(&self) -> &dyn CommandNodeTrait { &self.root_node } @@ -88,7 +91,7 @@ impl CommandContextBuilder<'_, S> { self } - pub fn with_node(mut self, node: dyn CommandNode, range: StringRange) -> Self { + pub fn with_node(mut self, node: dyn CommandNodeTrait, range: StringRange) -> Self { self.nodes.push(ParsedCommandNode::new(node, range)); self.range = StringRange::encompassing(&self.range, &range); self.modifier = node.redirect_modifier(); -- cgit v1.2.3