From 7ec9359c0ce77d5e55dc6acdc3e80732af0d98dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Haudebourg?= Date: Fri, 12 Jul 2024 11:46:07 +0200 Subject: [PATCH] Insert required types in `vc::syntax::Types::default`. --- crates/claims/crates/vc/src/syntax/types.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/crates/claims/crates/vc/src/syntax/types.rs b/crates/claims/crates/vc/src/syntax/types.rs index 9637fa1f3..bfd9027d2 100644 --- a/crates/claims/crates/vc/src/syntax/types.rs +++ b/crates/claims/crates/vc/src/syntax/types.rs @@ -29,9 +29,22 @@ pub trait TypeSerializationPolicy { /// [`RequiredType`], and more required types given by `T` implementing /// [`RequiredTypeSet`]. #[derive(Educe)] -#[educe(Debug, Default, Clone)] +#[educe(Debug, Clone)] pub struct Types(Vec, PhantomData<(B, T)>); +impl Default for Types { + fn default() -> Self { + Self( + T::REQUIRED_TYPES + .iter() + .copied() + .map(ToOwned::to_owned) + .collect(), + PhantomData, + ) + } +} + impl Types { pub fn additional_types(&self) -> &[String] { &self.0