use crate::Type;
#[derive(Debug, PartialEq, Clone)]
pub struct Field {
pub name: String,
pub r#type: Type,
}
impl Default for Field {
fn default() -> Self {
Self {
name: Default::default(),
r#type: Type::Other(Default::default()),
}
}
}
impl Field {
pub fn new(name: &str, r#type: Type) -> Self {
Self {
name: name.to_string(),
r#type,
}
}
}
#[derive(Debug, PartialEq, Default, Clone)]
pub struct FieldList(pub Vec<Field>);
impl std::ops::Deref for FieldList {
type Target = Vec<Field>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl FieldList {
pub fn push(&mut self, field: Field) {
self.0.push(field);
}
}