aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/tree
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2025-10-12 23:01:54 +0300
committermat <git@matdoes.dev>2025-10-12 23:01:54 +0300
commitee2575794e91b9457a74a95daf1dcc707058cd58 (patch)
treedf725850ef18ded5ce3f6552e17095d0f704ae84 /azalea-brigadier/src/tree
parent1a1402954b07cd77615d0afc026c73b008787f51 (diff)
downloadazalea-drasl-ee2575794e91b9457a74a95daf1dcc707058cd58.tar.xz
upgrade deps and clean up lots of doc comments
Diffstat (limited to 'azalea-brigadier/src/tree')
-rw-r--r--azalea-brigadier/src/tree/mod.rs18
1 files changed, 14 insertions, 4 deletions
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,