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/tree/mod.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'azalea-brigadier/src/tree') diff --git a/azalea-brigadier/src/tree/mod.rs b/azalea-brigadier/src/tree/mod.rs index 902e288b..cec972dc 100755 --- a/azalea-brigadier/src/tree/mod.rs +++ b/azalea-brigadier/src/tree/mod.rs @@ -10,9 +10,9 @@ use crate::{ modifier::RedirectModifier, string_reader::StringReader, }; -use std::{collections::HashMap, fmt::Debug, hash::Hash, ptr, rc::Rc, sync::Arc}; +use std::{collections::HashMap, fmt::Debug, hash::Hash, ptr, sync::Arc}; -pub type Command = Option) -> i32>>; +pub type Command = Option) -> i32 + Send + Sync>>; /// An ArgumentBuilder that has been built. #[non_exhaustive] @@ -24,10 +24,10 @@ pub struct CommandNode { pub arguments: HashMap>>>, pub command: Command, - pub requirement: Rc) -> bool>, + pub requirement: Arc) -> bool + Send + Sync>, pub redirect: Option>>>, pub forks: bool, - pub modifier: Option>>, + pub modifier: Option>>, } impl Clone for CommandNode { @@ -90,7 +90,7 @@ impl CommandNode { } } - pub fn can_use(&self, source: Rc) -> bool { + pub fn can_use(&self, source: Arc) -> bool { (self.requirement)(source) } @@ -221,7 +221,7 @@ impl Default for CommandNode { arguments: HashMap::new(), command: None, - requirement: Rc::new(|_| true), + requirement: Arc::new(|_| true), redirect: None, forks: false, modifier: None, @@ -257,7 +257,7 @@ impl PartialEq for CommandNode { // idk how to do this better since we can't compare `dyn Fn`s if let Some(otherexecutes) = &other.command { #[allow(clippy::vtable_address_comparisons)] - if !Rc::ptr_eq(selfexecutes, otherexecutes) { + if !Arc::ptr_eq(selfexecutes, otherexecutes) { return false; } } else { -- cgit v1.2.3