diff options
| author | Ubuntu <github@matdoes.dev> | 2022-01-13 00:43:09 +0000 |
|---|---|---|
| committer | Ubuntu <github@matdoes.dev> | 2022-01-13 00:43:09 +0000 |
| commit | eb111be1f107696939b994f5de6e060cf972a732 (patch) | |
| tree | 055deab4179088c5e91a179bfe465a7859c45ab6 /azalea-brigadier/src/tree/literal_command_node.rs | |
| parent | 270507736af57aae6801dc9eb3c3132139d0d07b (diff) | |
| download | azalea-drasl-eb111be1f107696939b994f5de6e060cf972a732.tar.xz | |
a
Diffstat (limited to 'azalea-brigadier/src/tree/literal_command_node.rs')
| -rw-r--r-- | azalea-brigadier/src/tree/literal_command_node.rs | 26 |
1 files changed, 9 insertions, 17 deletions
diff --git a/azalea-brigadier/src/tree/literal_command_node.rs b/azalea-brigadier/src/tree/literal_command_node.rs index 021a3ea6..a722121f 100644 --- a/azalea-brigadier/src/tree/literal_command_node.rs +++ b/azalea-brigadier/src/tree/literal_command_node.rs @@ -1,5 +1,5 @@ use crate::{ - arguments::argument_type::{ArgumentType, Types}, + arguments::argument_type::ArgumentType, builder::literal_argument_builder::LiteralArgumentBuilder, command::Command, context::{command_context::CommandContext, command_context_builder::CommandContextBuilder}, @@ -14,22 +14,15 @@ use crate::{ use super::command_node::{BaseCommandNode, CommandNode}; #[derive(Debug, Clone)] -pub struct LiteralCommandNode<'a, S, T> -where - // each argument command node has its own different type - T: ArgumentType<dyn Types>, -{ +pub struct LiteralCommandNode<'a, S> { 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>, + pub base: BaseCommandNode<'a, S>, } -impl<'a, S, T> LiteralCommandNode<'a, S, T> -where - T: ArgumentType<dyn Types>, -{ - pub fn new(literal: String, base: BaseCommandNode<S, T>) -> Self { +impl<'a, S> LiteralCommandNode<'a, S> { + pub fn new(literal: String, base: BaseCommandNode<S>) -> Self { let literal_lowercase = literal.to_lowercase(); Self { literal, @@ -59,9 +52,8 @@ where } } -impl<S, T> CommandNode<S, T> for LiteralCommandNode<'_, S, T> +impl<S> CommandNode<S> for LiteralCommandNode<'_, S> where - T: ArgumentType<dyn Types> + Clone, S: Clone, { fn name(&self) -> &str { @@ -71,7 +63,7 @@ where fn parse( &self, reader: StringReader, - context_builder: CommandContextBuilder<S, T>, + context_builder: CommandContextBuilder<S>, ) -> Result<(), CommandSyntaxException> { let start = reader.get_cursor(); let end = self.parse(reader); @@ -87,7 +79,7 @@ where fn list_suggestions( &self, - context: CommandContext<S, T>, + context: CommandContext<S>, builder: SuggestionsBuilder, ) -> Result<Suggestions, CommandSyntaxException> { if self @@ -108,7 +100,7 @@ where self.literal } - fn create_builder(&self) -> LiteralArgumentBuilder<S, T> { + fn create_builder(&self) -> LiteralArgumentBuilder<S> { let builder = LiteralArgumentBuilder::literal(self.literal()); builder.requires(self.requirement()); builder.forward(self.redirect(), self.redirect_modifier(), self.is_fork()); |
