gesha_rust_types/
struct_def.rs1use crate::{Definition, StructField, TypeHeader};
2
3#[derive(Clone, Debug, PartialEq)]
4pub struct StructDef {
5 pub header: TypeHeader,
6 pub fields: Vec<StructField>,
7 _hide_default_constructor: bool,
8}
9
10impl StructDef {
11 pub fn new(header: TypeHeader, fields: Vec<StructField>) -> Self {
12 Self {
13 header,
14 fields,
15 _hide_default_constructor: true,
16 }
17 }
18 pub fn symbol_name(&self) -> &str {
19 self.header.name.as_ref()
20 }
21}
22
23impl From<StructDef> for Definition {
24 fn from(x: StructDef) -> Self {
25 Self::StructDef(x)
26 }
27}