git.delta.rocks / jrsonnet / refs/commits / 0a2dd7a14884

difftreelog

feat(jrsonnet-types) implement gc

Yaroslav Bolyukin2021-06-05parent: #6794ed5.patch.diff
in: master
It is currently not possible to implement recursive type, so all tracing
is noop here

2 files changed

modifiedcrates/jrsonnet-types/Cargo.tomldiffbeforeafterboth
88
9[dependencies]9[dependencies]
10peg = "0.7.0"10peg = "0.7.0"
11gc = { version = "0.4.1", features = ["derive"] }
1112
modifiedcrates/jrsonnet-types/src/lib.rsdiffbeforeafterboth
--- a/crates/jrsonnet-types/src/lib.rs
+++ b/crates/jrsonnet-types/src/lib.rs
@@ -1,5 +1,6 @@
 #![allow(clippy::redundant_closure_call)]
 
+use gc::{unsafe_empty_trace, Finalize, Trace};
 use std::fmt::Display;
 
 #[macro_export]
@@ -87,6 +88,10 @@
 	Obj,
 	Func,
 }
+impl Finalize for ValType {}
+unsafe impl Trace for ValType {
+	unsafe_empty_trace!();
+}
 
 impl ValType {
 	pub const fn name(&self) -> &'static str {
@@ -123,6 +128,11 @@
 	Sum(Vec<ComplexValType>),
 	SumRef(&'static [ComplexValType]),
 }
+impl Finalize for ComplexValType {}
+unsafe impl Trace for ComplexValType {
+	unsafe_empty_trace!();
+}
+
 impl From<ValType> for ComplexValType {
 	fn from(s: ValType) -> Self {
 		Self::Simple(s)