Skip to content

Commit

Permalink
switch any-ref to RwLock; tag 0.6.6
Browse files Browse the repository at this point in the history
  • Loading branch information
tiye committed May 19, 2024
1 parent c8d9b9a commit 0b2a2f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cirru_edn"
version = "0.6.5"
version = "0.6.6"
authors = ["jiyinyiyong <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down
9 changes: 3 additions & 6 deletions src/edn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ mod tuple;

use std::{
any::Any,
cell::RefCell,
cmp::{
Eq,
Ordering::{self, *},
Expand All @@ -17,7 +16,7 @@ use std::{
hash::{Hash, Hasher},
iter::FromIterator,
ptr,
sync::Arc,
sync::{Arc, RwLock},
};

use cirru_parser::Cirru;
Expand Down Expand Up @@ -53,7 +52,7 @@ pub enum Edn {

/// Just a reference holding some Data in Rust, to use in Rust and pass in Calcit
#[derive(Debug, Clone)]
pub struct EdnAnyRef(pub Arc<RefCell<dyn Any>>);
pub struct EdnAnyRef(pub Arc<RwLock<dyn Any>>);

/// cannot predict behavior yet, but to bypass type checking
unsafe impl Send for EdnAnyRef {}
Expand All @@ -62,9 +61,7 @@ unsafe impl Sync for EdnAnyRef {}

impl PartialEq for EdnAnyRef {
fn eq(&self, other: &Self) -> bool {
let a = self.0.as_ptr();
let b = other.0.as_ptr();
std::ptr::addr_eq(a, b)
std::ptr::addr_eq(&self, &other)
}
}

Expand Down

0 comments on commit 0b2a2f9

Please sign in to comment.