Remove Rc from Parser's vars

This will help enable Parser to be Send, which will be important for
concurrent execution.
This commit is contained in:
Peter Ammon
2025-06-14 13:50:55 -07:00
parent 6f18a362e6
commit 2104f8a18a
8 changed files with 11 additions and 20 deletions

View File

@@ -422,7 +422,7 @@ pub struct Parser {
block_list: RefCell<Vec<Block>>,
/// Set of variables for the parser.
pub variables: Rc<EnvStack>,
pub variables: EnvStack,
/// Data managed in a scoped fashion.
scoped_data: ScopedCell<ScopedData>,
@@ -448,7 +448,7 @@ pub struct Parser {
impl Parser {
/// Create a parser.
pub fn new(variables: Rc<EnvStack>, cancel_behavior: CancelBehavior) -> Parser {
pub fn new(variables: EnvStack, cancel_behavior: CancelBehavior) -> Parser {
let result = Self {
line_counter: ScopedRefCell::new(LineCounter::empty()),
job_list: RefCell::default(),
@@ -886,11 +886,6 @@ pub fn vars(&self) -> &EnvStack {
&self.variables
}
/// Get the variables as an Rc.
pub fn vars_ref(&self) -> Rc<EnvStack> {
Rc::clone(&self.variables)
}
/// Get a copy of the scoped data.
#[inline(always)]
pub fn scope(&self) -> ScopedData {