Skip to content

Commit

Permalink
feat(jrsonnet-interner): implement gc
Browse files Browse the repository at this point in the history
Interned string is backed by Rc<str>, there is nothing to trace here

Signed-off-by: Yaroslav Bolyukin <[email protected]>
  • Loading branch information
CertainLach committed Jun 5, 2021
1 parent 10e83f0 commit c60f1e8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions crates/jrsonnet-interner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ edition = "2018"
[dependencies]
serde = { version = "1.0" }
rustc-hash = "1.1.0"
gc = { version = "0.4.1", features = ["derive"] }
5 changes: 5 additions & 0 deletions crates/jrsonnet-interner/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use gc::{unsafe_empty_trace, Finalize, Trace};
use rustc_hash::FxHashMap;
use serde::{Deserialize, Serialize};
use std::{
Expand All @@ -10,6 +11,10 @@ use std::{

#[derive(Clone, PartialOrd, Ord, Eq)]
pub struct IStr(Rc<str>);
impl Finalize for IStr {}
unsafe impl Trace for IStr {
unsafe_empty_trace!();
}

impl Deref for IStr {
type Target = str;
Expand Down

0 comments on commit c60f1e8

Please sign in to comment.