aboutsummaryrefslogtreecommitdiff
path: root/azalea-brigadier/src/context/command_context.rs
diff options
context:
space:
mode:
authormat <git@matdoes.dev>2023-05-05 23:09:57 -0500
committermat <git@matdoes.dev>2023-05-05 23:09:57 -0500
commit12370ab07609bf78baef4ec2302fa4ba44317dae (patch)
tree4fc8eecd79350cd06f52b7d3b5c166a0093fd10f /azalea-brigadier/src/context/command_context.rs
parente4176937f0584a6bcc5aba15abb1e2df6ddf588d (diff)
downloadazalea-drasl-12370ab07609bf78baef4ec2302fa4ba44317dae.tar.xz
change some things to be Arc+RwLock in brigadier
Diffstat (limited to 'azalea-brigadier/src/context/command_context.rs')
-rwxr-xr-xazalea-brigadier/src/context/command_context.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/azalea-brigadier/src/context/command_context.rs b/azalea-brigadier/src/context/command_context.rs
index 98609a6e..88af2002 100755
--- a/azalea-brigadier/src/context/command_context.rs
+++ b/azalea-brigadier/src/context/command_context.rs
@@ -1,9 +1,11 @@
+use parking_lot::RwLock;
+
use super::{parsed_command_node::ParsedCommandNode, string_range::StringRange, ParsedArgument};
use crate::{
modifier::RedirectModifier,
tree::{Command, CommandNode},
};
-use std::{any::Any, cell::RefCell, collections::HashMap, fmt::Debug, rc::Rc};
+use std::{any::Any, collections::HashMap, fmt::Debug, rc::Rc, sync::Arc};
/// A built `CommandContextBuilder`.
pub struct CommandContext<S> {
@@ -11,7 +13,7 @@ pub struct CommandContext<S> {
pub input: String,
pub arguments: HashMap<String, ParsedArgument>,
pub command: Command<S>,
- pub root_node: Rc<RefCell<CommandNode<S>>>,
+ pub root_node: Arc<RwLock<CommandNode<S>>>,
pub nodes: Vec<ParsedCommandNode<S>>,
pub range: StringRange,
pub child: Option<Rc<CommandContext<S>>>,