1use crate::Type;
2
3#[derive(Debug, PartialEq, Clone)]
4pub struct Field {
5 pub name: String,
6 pub r#type: Type,
7}
8
9impl Default for Field {
10 fn default() -> Self {
11 Self {
12 name: Default::default(),
13 r#type: Type::Other(Default::default()),
14 }
15 }
16}
17
18impl Field {
19 pub fn new(name: &str, r#type: Type) -> Self {
26 Self {
27 name: name.to_string(),
28 r#type,
29 }
30 }
31}
32
33#[derive(Debug, PartialEq, Default, Clone)]
34pub struct FieldList(pub Vec<Field>);
35
36impl std::ops::Deref for FieldList {
37 type Target = Vec<Field>;
38
39 fn deref(&self) -> &Self::Target {
40 &self.0
41 }
42}
43
44impl FieldList {
45 pub fn push(&mut self, field: Field) {
46 self.0.push(field);
47 }
48}