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/eval/value.rs | |
| parent | fa57d86ed981373b66804972147bf59cab920e6b (diff) | |
Switch from `Rc` to `Arc`
Diffstat (limited to 'src/eval/value.rs')
| -rw-r--r-- | src/eval/value.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/eval/value.rs b/src/eval/value.rs index e64f6cc6..7d65d5af 100644 --- a/src/eval/value.rs +++ b/src/eval/value.rs @@ -2,7 +2,7 @@ use std::any::Any; use std::cmp::Ordering; use std::fmt::{self, Debug, Formatter}; use std::hash::Hash; -use std::rc::Rc; +use std::sync::Arc; use super::{ops, Args, Array, Class, Dict, Function, Node}; use crate::diag::StrResult; @@ -58,7 +58,7 @@ impl Value { /// Create an inline-level node value. pub fn inline<T>(node: T) -> Self where - T: Layout + Debug + Hash + 'static, + T: Layout + Debug + Hash + Sync + Send + 'static, { Self::Node(Node::inline(node)) } @@ -66,7 +66,7 @@ impl Value { /// Create a block-level node value. pub fn block<T>(node: T) -> Self where - T: Layout + Debug + Hash + 'static, + T: Layout + Debug + Hash + Sync + Send + 'static, { Self::Node(Node::block(node)) } @@ -211,15 +211,15 @@ impl From<Dynamic> for Value { /// A dynamic value. #[derive(Clone)] -pub struct Dynamic(Rc<dyn Bounds>); +pub struct Dynamic(Arc<dyn Bounds>); impl Dynamic { /// Create a new instance from any value that satisifies the required bounds. pub fn new<T>(any: T) -> Self where - T: Type + Debug + PartialEq + 'static, + T: Type + Debug + PartialEq + Sync + Send + 'static, { - Self(Rc::new(any)) + Self(Arc::new(any)) } /// Whether the wrapped type is `T`. @@ -250,7 +250,7 @@ impl PartialEq for Dynamic { } } -trait Bounds: Debug + 'static { +trait Bounds: Debug + Sync + Send + 'static { fn as_any(&self) -> &dyn Any; fn dyn_eq(&self, other: &Dynamic) -> bool; fn dyn_type_name(&self) -> &'static str; @@ -258,7 +258,7 @@ trait Bounds: Debug + 'static { impl<T> Bounds for T where - T: Type + Debug + PartialEq + 'static, + T: Type + Debug + PartialEq + Sync + Send + 'static, { fn as_any(&self) -> &dyn Any { self |
