xsd_parser/models/data/
dynamic.rs

1use proc_macro2::{Ident as Ident2, Literal};
2
3use crate::models::{data::PathData, meta::DynamicMeta, Ident};
4
5/// Contains additional information for the rendering process of a
6/// [`MetaTypeVariant::Dynamic`](crate::models::meta::MetaTypeVariant::Dynamic)
7/// type.
8#[derive(Debug)]
9pub struct DynamicData<'types> {
10    /// Reference to the original type information.
11    pub meta: &'types DynamicMeta,
12
13    /// The identifier of the rendered type.
14    pub type_ident: Ident2,
15
16    /// The identifier of the trait that needs to be implemented
17    /// by the derived types.
18    pub trait_ident: Ident2,
19
20    /// Identifier of the deserializer for this type.
21    pub deserializer_ident: Ident2,
22
23    /// List of additional traits that need to be implemented by the derived
24    /// types (if this type was inherited from another dynamic type).
25    pub sub_traits: Option<Vec<PathData>>,
26
27    /// List of derived types.
28    pub derived_types: Vec<DerivedType>,
29}
30
31/// Represents a derived type used by [`DynamicData`]
32#[derive(Debug)]
33pub struct DerivedType {
34    /// Identifier of the derived type.
35    pub ident: Ident,
36
37    /// Name of the derived type as byte string literal.
38    pub b_name: Literal,
39
40    /// The actual target type of this derived type information.
41    pub target_type: PathData,
42
43    /// Name of the variant used for this derived type information.
44    pub variant_ident: Ident2,
45}