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
--- a/crates/jrsonnet-types/Cargo.toml
+++ b/crates/jrsonnet-types/Cargo.toml
@@ -8,3 +8,4 @@
 
 [dependencies]
 peg = "0.7.0"
+gc = { version = "0.4.1", features = ["derive"] }
modifiedcrates/jrsonnet-types/src/lib.rsdiffbeforeafterboth
1#![allow(clippy::redundant_closure_call)]1#![allow(clippy::redundant_closure_call)]
22
3use gc::{unsafe_empty_trace, Finalize, Trace};
3use std::fmt::Display;4use std::fmt::Display;
45
5#[macro_export]6#[macro_export]
87 Obj,88 Obj,
88 Func,89 Func,
89}90}
91impl Finalize for ValType {}
92unsafe impl Trace for ValType {
93 unsafe_empty_trace!();
94}
9095
91impl ValType {96impl ValType {
92 pub const fn name(&self) -> &'static str {97 pub const fn name(&self) -> &'static str {
123 Sum(Vec<ComplexValType>),128 Sum(Vec<ComplexValType>),
124 SumRef(&'static [ComplexValType]),129 SumRef(&'static [ComplexValType]),
125}130}
131impl Finalize for ComplexValType {}
132unsafe impl Trace for ComplexValType {
133 unsafe_empty_trace!();
134}
135
126impl From<ValType> for ComplexValType {136impl From<ValType> for ComplexValType {
127 fn from(s: ValType) -> Self {137 fn from(s: ValType) -> Self {