diff options
| author | mat <git@matdoes.dev> | 2023-05-05 23:23:11 -0500 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2023-05-05 23:23:11 -0500 |
| commit | f825544e2776ab545ff0a9c674b68183120695cb (patch) | |
| tree | a294fa38650e4ce511fc4d6c8b166f13e23ba18e /azalea-brigadier/src/builder/argument_builder.rs | |
| parent | 12370ab07609bf78baef4ec2302fa4ba44317dae (diff) | |
| download | azalea-drasl-f825544e2776ab545ff0a9c674b68183120695cb.tar.xz | |
CommandDispatcher is now Send+Sync
Diffstat (limited to 'azalea-brigadier/src/builder/argument_builder.rs')
| -rwxr-xr-x | azalea-brigadier/src/builder/argument_builder.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/azalea-brigadier/src/builder/argument_builder.rs b/azalea-brigadier/src/builder/argument_builder.rs index a1f3d6ae..c6f2146a 100755 --- a/azalea-brigadier/src/builder/argument_builder.rs +++ b/azalea-brigadier/src/builder/argument_builder.rs @@ -7,7 +7,7 @@ use crate::{ }; use super::{literal_argument_builder::Literal, required_argument_builder::Argument}; -use std::{fmt::Debug, rc::Rc, sync::Arc}; +use std::{fmt::Debug, sync::Arc}; #[derive(Debug, Clone)] pub enum ArgumentBuilderType { @@ -20,11 +20,11 @@ pub struct ArgumentBuilder<S> { arguments: CommandNode<S>, command: Command<S>, - requirement: Rc<dyn Fn(Rc<S>) -> bool>, + requirement: Arc<dyn Fn(Arc<S>) -> bool + Send + Sync>, target: Option<Arc<RwLock<CommandNode<S>>>>, forks: bool, - modifier: Option<Rc<RedirectModifier<S>>>, + modifier: Option<Arc<RedirectModifier<S>>>, } /// A node that isn't yet built. @@ -36,7 +36,7 @@ impl<S> ArgumentBuilder<S> { ..Default::default() }, command: None, - requirement: Rc::new(|_| true), + requirement: Arc::new(|_| true), forks: false, modifier: None, target: None, @@ -54,17 +54,17 @@ impl<S> ArgumentBuilder<S> { pub fn executes<F>(mut self, f: F) -> Self where - F: Fn(&CommandContext<S>) -> i32 + 'static, + F: Fn(&CommandContext<S>) -> i32 + Send + Sync + 'static, { - self.command = Some(Rc::new(f)); + self.command = Some(Arc::new(f)); self } pub fn requires<F>(mut self, requirement: F) -> Self where - F: Fn(Rc<S>) -> bool + 'static, + F: Fn(Arc<S>) -> bool + Send + Sync + 'static, { - self.requirement = Rc::new(requirement); + self.requirement = Arc::new(requirement); self } @@ -75,7 +75,7 @@ impl<S> ArgumentBuilder<S> { pub fn fork( self, target: Arc<RwLock<CommandNode<S>>>, - modifier: Rc<RedirectModifier<S>>, + modifier: Arc<RedirectModifier<S>>, ) -> Self { self.forward(target, Some(modifier), true) } @@ -83,7 +83,7 @@ impl<S> ArgumentBuilder<S> { pub fn forward( mut self, target: Arc<RwLock<CommandNode<S>>>, - modifier: Option<Rc<RedirectModifier<S>>>, + modifier: Option<Arc<RedirectModifier<S>>>, fork: bool, ) -> Self { if !self.arguments.children.is_empty() { |
