Add primitive struct & enum

This commit is contained in:
Guilhem 2022-06-13 17:53:43 +02:00
parent 78529bd5e2
commit 2ae63e33b5
2 changed files with 45 additions and 0 deletions

41
src/lib.rs Normal file
View File

@ -0,0 +1,41 @@
pub enum NotationKind {
Iso,
Palmer,
Uns,
Alphanumeric,
}
pub enum TeethKind {
Canine,
Incisor,
Premolar,
Molar,
}
#[derive(PartialEq, Clone, Copy)]
pub enum QuadrantKind {
TopLeft,
TopRight,
BottomLeft,
BottomRight,
}
pub struct Teeth {
quadrant: QuadrantKind,
number: u8,
permanent: bool,
}
impl Teeth {
pub fn new(number: u8, quadrant: QuadrantKind, permanent: bool) -> Teeth {
if !permanent && number > 5 {
panic!("Primary tooth number are in range [1; 5]");
}
Teeth {
number,
quadrant,
permanent,
}
}
}

4
src/main.rs Normal file
View File

@ -0,0 +1,4 @@
mod display;
mod lib;
fn main() {
}