✨ Add primitive struct & enum
This commit is contained in:
parent
78529bd5e2
commit
2ae63e33b5
41
src/lib.rs
Normal file
41
src/lib.rs
Normal 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
4
src/main.rs
Normal file
@ -0,0 +1,4 @@
|
||||
mod display;
|
||||
mod lib;
|
||||
fn main() {
|
||||
}
|
Loading…
Reference in New Issue
Block a user