Skip to content

Commit

Permalink
Insert required types in vc::syntax::Types::default. (#579)
Browse files Browse the repository at this point in the history
  • Loading branch information
timothee-haudebourg authored Jul 12, 2024
1 parent 7a944d7 commit 3f2b1d3
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion crates/claims/crates/vc/src/syntax/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<B, T = ()>(Vec<String>, PhantomData<(B, T)>);

impl<B, T: RequiredTypeSet> Default for Types<B, T> {
fn default() -> Self {
Self(
T::REQUIRED_TYPES
.iter()
.copied()
.map(ToOwned::to_owned)
.collect(),
PhantomData,
)
}
}

impl<B, T> Types<B, T> {
pub fn additional_types(&self) -> &[String] {
&self.0
Expand Down

0 comments on commit 3f2b1d3

Please sign in to comment.