From 2ae63e33b530000e5bb172d747db3440ff8a3687 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Mon, 13 Jun 2022 17:53:43 +0200 Subject: [PATCH] :sparkles: Add primitive struct & enum --- src/lib.rs | 41 +++++++++++++++++++++++++++++++++++++++++ src/main.rs | 4 ++++ 2 files changed, 45 insertions(+) create mode 100644 src/lib.rs create mode 100644 src/main.rs diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..1fde4cf --- /dev/null +++ b/src/lib.rs @@ -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, + } + } + +} diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..639a6f8 --- /dev/null +++ b/src/main.rs @@ -0,0 +1,4 @@ +mod display; +mod lib; +fn main() { +}