git.delta.rocks / jrsonnet / refs/commits / 905c3fce02d8

difftreelog

refactor drop IntoUntyped for Thunk<T>

zvwvlqrpYaroslav Bolyukin2026-03-23parent: #186ae51.patch.diff
in: master
Unnecessarily reallocates... I wish we had specialization...

1 file changed

modifiedcrates/jrsonnet-evaluator/src/typed/conversions.rsdiffbeforeafterboth
127 const TYPE: &'static ComplexValType = &ComplexValType::Lazy(T::TYPE);127 const TYPE: &'static ComplexValType = &ComplexValType::Lazy(T::TYPE);
128}128}
129129
130impl<T> IntoUntyped for Thunk<T>130impl IntoUntyped for Thunk<Val> {
131where
132 T: Typed + IntoUntyped + Trace + Clone,
133{
134 fn into_untyped(typed: Self) -> Result<Val> {131 fn into_untyped(typed: Self) -> Result<Val> {
135 T::into_untyped(typed.evaluate()?)132 typed.evaluate()
136 }133 }
137 fn provides_lazy() -> bool {134 fn provides_lazy() -> bool {
138 true135 true
139 }136 }
140137
141 fn into_lazy_untyped(inner: Self) -> Thunk<Val> {138 fn into_lazy_untyped(inner: Self) -> Thunk<Val> {
142 inner.map(<ThunkIntoUntyped<T>>::default())139 inner
143 }140 }
144}141}
145142