pub struct StructInfo {
pub name: String,
pub fields: Vec<FieldInfo>,
pub file_path: String,
pub is_enum: bool,
pub serde_rename_all: Option<RenameRule>,
pub serde_tag: Option<String>,
pub enum_variants: Option<Vec<EnumVariantInfo>>,
}Fields§
§name: String§fields: Vec<FieldInfo>§file_path: String§is_enum: bool§serde_rename_all: Option<RenameRule>Serde rename_all attribute: #[serde(rename_all = “…”)]
serde_tag: Option<String>Serde tag attribute for enums: #[serde(tag = “…”)] Used for internally-tagged enum representation
enum_variants: Option<Vec<EnumVariantInfo>>Enum variants with full type information (only populated for enums)
When populated, provides richer variant data than the fields vector
Implementations§
Source§impl StructInfo
impl StructInfo
Sourcepub fn is_simple_enum(&self) -> bool
pub fn is_simple_enum(&self) -> bool
Returns true if this is a simple enum (all unit variants) Simple enums can be represented as TypeScript string literal unions
Sourcepub fn is_complex_enum(&self) -> bool
pub fn is_complex_enum(&self) -> bool
Returns true if this is a complex enum (has tuple or struct variants) Complex enums need discriminated union representation in TypeScript
Sourcepub fn discriminator_tag(&self) -> &str
pub fn discriminator_tag(&self) -> &str
Returns the discriminator tag name for this enum Defaults to “type” if not specified via #[serde(tag = “…”)]
Trait Implementations§
Source§impl Clone for StructInfo
impl Clone for StructInfo
Source§fn clone(&self) -> StructInfo
fn clone(&self) -> StructInfo
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for StructInfo
impl RefUnwindSafe for StructInfo
impl Send for StructInfo
impl Sync for StructInfo
impl Unpin for StructInfo
impl UnsafeUnpin for StructInfo
impl UnwindSafe for StructInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more