Skip to main content

xsd_parser/models/data/
reference.rs

1use std::borrow::Cow;
2
3use proc_macro2::{Ident as Ident2, TokenStream};
4
5use crate::config::TypedefMode;
6use crate::models::{
7    data::{Occurs, PathData},
8    meta::ReferenceMeta,
9};
10
11/// Contains additional information for the rendering process of a
12/// [`MetaTypeVariant::Reference`](crate::models::meta::MetaTypeVariant::Reference)
13/// type.
14#[derive(Debug)]
15pub struct ReferenceData<'types> {
16    /// Reference to the original type information.
17    pub meta: Cow<'types, ReferenceMeta>,
18
19    /// Typedef mode that should be used to render this reference type.
20    pub mode: TypedefMode,
21
22    /// Occurrence of the referenced type within this type.
23    pub occurs: Occurs,
24
25    /// The identifier of the rendered type.
26    pub type_ident: Ident2,
27
28    /// Actual target type of this referenced type.
29    pub target_type: PathData,
30
31    /// List of traits that needs to be implemented by this type.
32    pub trait_impls: Vec<TokenStream>,
33}