Added a table field.
Some checks failed
MoreThanText/morethantext/pipeline/head There was a failure building this commit
Some checks failed
MoreThanText/morethantext/pipeline/head There was a failure building this commit
This commit is contained in:
@@ -6,11 +6,18 @@ pub enum Field {
|
||||
ID(ID),
|
||||
}
|
||||
|
||||
pub trait FieldRecord {
|
||||
fn new_field() -> Field;
|
||||
impl Field {
|
||||
fn new(field_type: &str) -> Field {
|
||||
ID::new_field()
|
||||
}
|
||||
}
|
||||
|
||||
struct Record {
|
||||
pub trait FieldRecord {
|
||||
fn new_field() -> Field;
|
||||
fn get_type() -> String;
|
||||
}
|
||||
|
||||
pub struct Record {
|
||||
data: HashMap<String, Field>,
|
||||
}
|
||||
|
||||
@@ -39,6 +46,19 @@ impl fmt::Display for Field {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod fields {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn creaAte_new_id() {
|
||||
match Field::new("id") {
|
||||
Field::ID(_) => {}
|
||||
_ => unreachable!("Fould should be an ID type."),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod records {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user