xsd_parser/models/meta/
dynamic.rs1use std::hash::Hasher;
4
5use crate::models::Ident;
6
7use super::{MetaTypes, TypeEq};
8
9#[derive(Default, Debug, Clone)]
11pub struct DynamicMeta {
12 pub type_: Option<Ident>,
14
15 pub derived_types: Vec<Ident>,
17}
18
19impl TypeEq for DynamicMeta {
20 fn type_hash<H: Hasher>(&self, hasher: &mut H, types: &MetaTypes) {
21 let Self {
22 type_,
23 derived_types,
24 } = self;
25
26 type_.type_hash(hasher, types);
27 TypeEq::type_hash_slice(derived_types, hasher, types);
28 }
29
30 fn type_eq(&self, other: &Self, types: &MetaTypes) -> bool {
31 let Self {
32 type_,
33 derived_types,
34 } = self;
35
36 type_.type_eq(&other.type_, types)
37 && TypeEq::type_eq_iter(derived_types.iter(), other.derived_types.iter(), types)
38 }
39}