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