diff options
| author | mat <git@matdoes.dev> | 2025-10-12 23:01:54 +0300 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2025-10-12 23:01:54 +0300 |
| commit | ee2575794e91b9457a74a95daf1dcc707058cd58 (patch) | |
| tree | df725850ef18ded5ce3f6552e17095d0f704ae84 /azalea-brigadier/src | |
| parent | 1a1402954b07cd77615d0afc026c73b008787f51 (diff) | |
| download | azalea-drasl-ee2575794e91b9457a74a95daf1dcc707058cd58.tar.xz | |
upgrade deps and clean up lots of doc comments
Diffstat (limited to 'azalea-brigadier/src')
| -rw-r--r-- | azalea-brigadier/src/builder/argument_builder.rs | 10 | ||||
| -rw-r--r-- | azalea-brigadier/src/builder/required_argument_builder.rs | 5 | ||||
| -rw-r--r-- | azalea-brigadier/src/command_dispatcher.rs | 6 | ||||
| -rw-r--r-- | azalea-brigadier/src/tree/mod.rs | 18 |
4 files changed, 27 insertions, 12 deletions
diff --git a/azalea-brigadier/src/builder/argument_builder.rs b/azalea-brigadier/src/builder/argument_builder.rs index 945f7fcb..27320eba 100644 --- a/azalea-brigadier/src/builder/argument_builder.rs +++ b/azalea-brigadier/src/builder/argument_builder.rs @@ -77,8 +77,9 @@ impl<S> ArgumentBuilder<S> { self } - /// Set the command to be executed when this node is reached. If this is not - /// present on a node, it is not a valid command. + /// Set the command to be executed when this node is reached. + /// + /// If this is not present on a node, it is not a valid command. /// /// ``` /// # use azalea_brigadier::prelude::*; @@ -105,8 +106,9 @@ impl<S> ArgumentBuilder<S> { self } - /// Set the requirement for this node to be considered. If this is not - /// present on a node, it is considered to always pass. + /// Set the requirement for this node to be considered. + /// + /// If this is not present on a node, it is considered to always pass. /// /// ``` /// # use azalea_brigadier::prelude::*; diff --git a/azalea-brigadier/src/builder/required_argument_builder.rs b/azalea-brigadier/src/builder/required_argument_builder.rs index 3fc33143..5aca8617 100644 --- a/azalea-brigadier/src/builder/required_argument_builder.rs +++ b/azalea-brigadier/src/builder/required_argument_builder.rs @@ -13,8 +13,9 @@ use crate::{ suggestion::{SuggestionProvider, Suggestions, SuggestionsBuilder}, }; -/// An argument node type. The `T` type parameter is the type of the argument, -/// which can be anything. +/// An argument node type. +/// +/// The `T` type parameter is the type of the argument, which can be anything. pub struct Argument<S> { pub name: String, parser: Arc<dyn ArgumentType + Send + Sync>, diff --git a/azalea-brigadier/src/command_dispatcher.rs b/azalea-brigadier/src/command_dispatcher.rs index d9a45132..a2024139 100644 --- a/azalea-brigadier/src/command_dispatcher.rs +++ b/azalea-brigadier/src/command_dispatcher.rs @@ -173,8 +173,10 @@ impl<S> CommandDispatcher<S> { }) } - /// Parse and execute the command using the given input and context. The - /// number returned depends on the command, and may not be of significance. + /// Parse and execute the command using the given input and context. + /// + /// The number returned depends on the command, and may not be of + /// significance. /// /// This is a shortcut for `Self::parse` and `Self::execute_parsed`. pub fn execute( diff --git a/azalea-brigadier/src/tree/mod.rs b/azalea-brigadier/src/tree/mod.rs index 993b0698..12a5a50c 100644 --- a/azalea-brigadier/src/tree/mod.rs +++ b/azalea-brigadier/src/tree/mod.rs @@ -57,16 +57,26 @@ impl<S> Clone for CommandNode<S> { } impl<S> CommandNode<S> { - /// Gets the literal, or panics. You should use match if you're not certain - /// about the type. + /// Returns the value as a literal from this command node, assuming it's + /// already been checked. + /// + /// # Panics + /// + /// Will panic if this node is not a literal. Consider using a match + /// statement instead. pub fn literal(&self) -> &Literal { match self.value { ArgumentBuilderType::Literal(ref literal) => literal, _ => panic!("CommandNode::literal() called on non-literal node"), } } - /// Gets the argument, or panics. You should use match if you're not certain - /// about the type. + /// Returns the value as an argument from this command node, assuming it's + /// already been checked. + /// + /// # Panics + /// + /// Will panic if this node is not an argument. Consider using a match + /// statement instead. pub fn argument(&self) -> &Argument<S> { match self.value { ArgumentBuilderType::Argument(ref argument) => argument, |
