Skip to content

Commit 3bc4e49

Browse files
committed
Add Send marker to 's
1 parent a6bbcc3 commit 3bc4e49

File tree

2 files changed

+5
-10
lines changed

2 files changed

+5
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "json"
3-
version = "0.11.2"
3+
version = "0.11.3"
44
authors = ["Maciej Hirsz <maciej.hirsz@gmail.com>"]
55
description = "JSON implementation in Rust"
66
repository = "https://github.com/maciejhirsz/json-rust"

src/object.rs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,10 @@ impl PartialEq for Node {
4848
}
4949
}
5050

51-
// Because `Node` contains a raw pointer, `Sync` marker is missing. This
52-
// in turn disables `Sync` for `Object`, and eventually `JsonValue`. Without
53-
// the `Sync` marker it's impossible to create a static `JsonValue`, which
54-
// would break all the API that returns `&'static JsonValue::Null`.
55-
//
56-
// Since `Node` is not exposed anywhere in the API on it's own, and we manage
57-
// heap of long keys manually, we just need to tell the compiler we know what
58-
// we are doing here.
59-
unsafe impl Sync for Node { }
51+
// Implement `Sync` and `Send` for `Node` despite the use of raw pointers. The struct
52+
// itself should be memory safe.
53+
unsafe impl Sync for Node {}
54+
unsafe impl Send for Node {}
6055

6156
// FNV-1a implementation
6257
//

0 commit comments

Comments
 (0)