From f825544e2776ab545ff0a9c674b68183120695cb Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 5 May 2023 23:23:11 -0500 Subject: CommandDispatcher is now Send+Sync --- azalea-brigadier/src/builder/required_argument_builder.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'azalea-brigadier/src/builder/required_argument_builder.rs') 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, + parser: Arc, } impl Argument { - pub fn new(name: &str, parser: Rc) -> Self { + pub fn new(name: &str, parser: Arc) -> 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(name: &str, parser: impl ArgumentType + 'static) -> ArgumentBuilder { - ArgumentBuilder::new(Argument::new(name, Rc::new(parser)).into()) +pub fn argument( + name: &str, + parser: impl ArgumentType + Send + Sync + 'static, +) -> ArgumentBuilder { + ArgumentBuilder::new(Argument::new(name, Arc::new(parser)).into()) } -- cgit v1.2.3