From 444139496f5546f409aa0c5ac6883b181f7a7fc3 Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Fri, 21 Jan 2022 08:22:41 -0600 Subject: [PATCH] Swap out `Rc` for `Arc` to make stories thread-safe. --- src/context/full_context.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/context/full_context.rs b/src/context/full_context.rs index d08c0cf..238b837 100644 --- a/src/context/full_context.rs +++ b/src/context/full_context.rs @@ -1,7 +1,7 @@ use crate::context::Position; use crate::context::PositionKind; use std::borrow::Borrow; -use std::rc::Rc; +use std::sync::Arc; /// A context that represents a span of twee code with a beginning, end, and /// contents, along with a file name and some helper functions @@ -10,8 +10,8 @@ pub struct FullContext { file_name: Option, start_position: Position, end_position: Position, - contents: Rc, - line_starts: Rc>, + contents: Arc, + line_starts: Arc>, } mod util { @@ -46,8 +46,8 @@ impl FullContext { file_name: Option, start_position: Position, end_position: Position, - contents: Rc, - line_starts: Rc>, + contents: Arc, + line_starts: Arc>, ) -> Self { FullContext { file_name, @@ -116,8 +116,8 @@ impl FullContext { file_name, start, end, - Rc::new(contents), - Rc::new(line_starts), + Arc::new(contents), + Arc::new(line_starts), ) }