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/function.rs | |
| parent | fa57d86ed981373b66804972147bf59cab920e6b (diff) | |
Switch from `Rc` to `Arc`
Diffstat (limited to 'src/eval/function.rs')
| -rw-r--r-- | src/eval/function.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/eval/function.rs b/src/eval/function.rs index 931a90a0..0edc1e78 100644 --- a/src/eval/function.rs +++ b/src/eval/function.rs @@ -1,5 +1,5 @@ use std::fmt::{self, Debug, Formatter, Write}; -use std::rc::Rc; +use std::sync::Arc; use super::{Cast, EvalContext, Value}; use crate::diag::{At, TypResult}; @@ -8,9 +8,9 @@ use crate::util::EcoString; /// An evaluatable function. #[derive(Clone)] -pub struct Function(Rc<Inner<Func>>); +pub struct Function(Arc<Inner<Func>>); -/// The unsized structure behind the [`Rc`]. +/// The unsized structure behind the [`Arc`]. struct Inner<T: ?Sized> { name: Option<EcoString>, func: T, @@ -24,7 +24,7 @@ impl Function { where F: Fn(&mut EvalContext, &mut Args) -> TypResult<Value> + 'static, { - Self(Rc::new(Inner { name, func })) + Self(Arc::new(Inner { name, func })) } /// The name of the function. @@ -53,8 +53,8 @@ impl PartialEq for Function { fn eq(&self, other: &Self) -> bool { // We cast to thin pointers for comparison. std::ptr::eq( - Rc::as_ptr(&self.0) as *const (), - Rc::as_ptr(&other.0) as *const (), + Arc::as_ptr(&self.0) as *const (), + Arc::as_ptr(&other.0) as *const (), ) } } |
