aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/builder/required_argument_builder.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-05-12 23:40:34 -0500
committermat <git@matdoes.dev>2023-05-12 23:40:34 -0500
commit49952dd1507d70cd63305ffbcae4b062dfb4ce68 (patch)
tree1b3e5bbd757634048988b9c8d96d5fb97f669427 /azalea-brigadier/src/builder/required_argument_builder.rs
parent657c073eab0f09d873bde21d5cdeb13a1bebb71b (diff)
parent2057877eba5f6f13ba6863b48a9cdd44910a44f8 (diff)
downloadazalea-drasl-49952dd1507d70cd63305ffbcae4b062dfb4ce68.tar.xz
Merge branch 'main' into 1.20
Diffstat (limited to 'azalea-brigadier/src/builder/required_argument_builder.rs')
-rwxr-xr-xazalea-brigadier/src/builder/required_argument_builder.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/azalea-brigadier/src/builder/required_argument_builder.rs b/azalea-brigadier/src/builder/required_argument_builder.rs
index 9d4d9e0a..0363d204 100755
--- a/azalea-brigadier/src/builder/required_argument_builder.rs
+++ b/azalea-brigadier/src/builder/required_argument_builder.rs
@@ -2,17 +2,17 @@ use super::argument_builder::{ArgumentBuilder, ArgumentBuilderType};
use crate::{
arguments::ArgumentType, exceptions::CommandSyntaxException, string_reader::StringReader,
};
-use std::{any::Any, fmt::Debug, rc::Rc};
+use std::{any::Any, fmt::Debug, rc::Rc, sync::Arc};
/// An argument node type. The `T` type parameter is the type of the argument,
/// which can be anything.
#[derive(Clone)]
pub struct Argument {
pub name: String,
- parser: Rc<dyn ArgumentType>,
+ parser: Arc<dyn ArgumentType + Send + Sync>,
}
impl Argument {
- pub fn new(name: &str, parser: Rc<dyn ArgumentType>) -> Self {
+ pub fn new(name: &str, parser: Arc<dyn ArgumentType + Send + Sync>) -> Self {
Self {
name: name.to_string(),
parser,
@@ -40,6 +40,9 @@ impl Debug for Argument {
}
/// Shortcut for creating a new argument builder node.
-pub fn argument<S>(name: &str, parser: impl ArgumentType + 'static) -> ArgumentBuilder<S> {
- ArgumentBuilder::new(Argument::new(name, Rc::new(parser)).into())
+pub fn argument<S>(
+ name: &str,
+ parser: impl ArgumentType + Send + Sync + 'static,
+) -> ArgumentBuilder<S> {
+ ArgumentBuilder::new(Argument::new(name, Arc::new(parser)).into())
}