diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-01-31 16:06:44 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-01-31 16:47:00 +0100 |
| commit | 20b1a38414101f842a6d9201133a5aaaa45a7cec (patch) | |
| tree | 2365453d4dfdebfa11d618baad1a36c65b62d7c7 /src/syntax/mod.rs | |
| parent | fa57d86ed981373b66804972147bf59cab920e6b (diff) | |
Switch from `Rc` to `Arc`
Diffstat (limited to 'src/syntax/mod.rs')
| -rw-r--r-- | src/syntax/mod.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/syntax/mod.rs b/src/syntax/mod.rs index 03a496dd..a26384e1 100644 --- a/src/syntax/mod.rs +++ b/src/syntax/mod.rs @@ -7,7 +7,7 @@ mod span; use std::fmt::{self, Debug, Display, Formatter}; use std::ops::Range; -use std::rc::Rc; +use std::sync::Arc; pub use highlight::*; pub use pretty::*; @@ -24,7 +24,7 @@ use crate::util::EcoString; #[derive(Clone, PartialEq)] pub enum Green { /// A reference-counted inner node. - Node(Rc<GreenNode>), + Node(Arc<GreenNode>), /// A terminal, owned token. Token(GreenData), } @@ -76,7 +76,7 @@ impl Green { pub fn convert(&mut self, kind: NodeKind) { match self { Self::Node(node) => { - let node = Rc::make_mut(node); + let node = Arc::make_mut(node); node.erroneous |= kind.is_error(); node.data.kind = kind; } @@ -187,12 +187,12 @@ impl GreenNode { impl From<GreenNode> for Green { fn from(node: GreenNode) -> Self { - Rc::new(node).into() + Arc::new(node).into() } } -impl From<Rc<GreenNode>> for Green { - fn from(node: Rc<GreenNode>) -> Self { +impl From<Arc<GreenNode>> for Green { + fn from(node: Arc<GreenNode>) -> Self { Self::Node(node) } } @@ -259,7 +259,7 @@ pub struct RedNode { impl RedNode { /// Create a new red node from a root [`GreenNode`]. - pub fn from_root(root: Rc<GreenNode>, id: SourceId) -> Self { + pub fn from_root(root: Arc<GreenNode>, id: SourceId) -> Self { Self { id, offset: 0, green: root.into() } } @@ -611,9 +611,9 @@ pub enum NodeKind { Emph, /// An arbitrary number of backticks followed by inner contents, terminated /// with the same number of backticks: `` `...` ``. - Raw(Rc<RawNode>), + Raw(Arc<RawNode>), /// Dollar signs surrounding inner contents. - Math(Rc<MathNode>), + Math(Arc<MathNode>), /// A section heading: `= Introduction`. Heading, /// An item in an unordered list: `- ...`. |
