diff options
| author | Ubuntu <github@matdoes.dev> | 2022-01-12 00:40:43 +0000 |
|---|---|---|
| committer | Ubuntu <github@matdoes.dev> | 2022-01-12 00:40:43 +0000 |
| commit | 270507736af57aae6801dc9eb3c3132139d0d07b (patch) | |
| tree | a8fa1d1b8d038eb9d7e2061342026d23ddbd9027 /azalea-brigadier/src/tree/argument_command_node.rs | |
| parent | cc4fe62fc82842e0bde628437a45d55c6a82f1f3 (diff) | |
| download | azalea-drasl-270507736af57aae6801dc9eb3c3132139d0d07b.tar.xz | |
a
Diffstat (limited to 'azalea-brigadier/src/tree/argument_command_node.rs')
| -rw-r--r-- | azalea-brigadier/src/tree/argument_command_node.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/azalea-brigadier/src/tree/argument_command_node.rs b/azalea-brigadier/src/tree/argument_command_node.rs index 647b6c35..3fc1bb50 100644 --- a/azalea-brigadier/src/tree/argument_command_node.rs +++ b/azalea-brigadier/src/tree/argument_command_node.rs @@ -21,6 +21,7 @@ use super::command_node::{BaseCommandNode, CommandNode}; const USAGE_ARGUMENT_OPEN: &str = "<"; const USAGE_ARGUMENT_CLOSE: &str = ">"; +#[derive(Clone)] pub struct ArgumentCommandNode<'a, S, T> where // each argument command node has its own different type @@ -34,7 +35,10 @@ where pub base: BaseCommandNode<'a, S, T>, } -impl<S, T> ArgumentCommandNode<'_, S, T> { +impl<S, T> ArgumentCommandNode<'_, S, T> +where + T: ArgumentType<dyn Types>, +{ fn get_type(&self) -> &T { &self.type_ } @@ -44,7 +48,11 @@ impl<S, T> ArgumentCommandNode<'_, S, T> { } } -impl<'a, S, T> CommandNode<S, T> for ArgumentCommandNode<'a, S, T> { +impl<'a, S, T> CommandNode<S, T> for ArgumentCommandNode<'a, S, T> +where + T: ArgumentType<dyn Types> + Clone, + S: Clone, +{ fn name(&self) -> &str { &self.name } @@ -117,7 +125,10 @@ impl<'a, S, T> CommandNode<S, T> for ArgumentCommandNode<'a, S, T> { } } -impl Display for ArgumentCommandNode<'_, (), (), ()> { +impl<S, T> Display for ArgumentCommandNode<'_, S, T> +where + T: ArgumentType<dyn Types>, +{ fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { write!(f, "<argument {}: {}>", self.name, self.type_) } |
