gesha_rust_types/
struct_field.rs1use crate::{DataType, StructFieldName};
2use std::fmt::{Display, Formatter};
3
4#[derive(Clone, Debug, Hash, Eq, PartialEq)]
5pub struct StructField {
6 pub name: StructFieldName,
7 pub data_type: DataType,
8 pub attributes: Vec<StructFieldAttribute>,
9 _hide_default_constructor: bool,
10}
11
12impl StructField {
13 pub fn new(
14 name: StructFieldName,
15 data_type: DataType,
16 attributes: Vec<StructFieldAttribute>,
17 ) -> Self {
18 Self {
19 name,
20 data_type,
21 attributes,
22 _hide_default_constructor: true,
23 }
24 }
25}
26
27#[derive(Clone, Debug, Hash, Eq, PartialEq)]
28pub struct StructFieldAttribute(String);
29
30impl StructFieldAttribute {
31 pub fn new<A: Into<String>>(a: A) -> Self {
32 Self(a.into())
33 }
34}
35
36impl Display for StructFieldAttribute {
37 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
38 Display::fmt(&self.0, f)
39 }
40}