From 30ec23ef1b843fabfde6433811a58316cb0155e0 Mon Sep 17 00:00:00 2001 From: Brad Clawsie Date: Tue, 3 Nov 2026 14:09:53 -0600 Subject: feat: ex4_6 commit 24ee236d4750f0d7ee7bca005066d80f0e29c0d7 Author: Brad Clawsie Date: Tue Nov 3 14:09:39 2026 -0600 feat: ex4_6 --- ex4_6/src/main.rs | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 ex4_6/src/main.rs (limited to 'ex4_6/src/main.rs') diff --git a/ex4_6/src/main.rs b/ex4_6/src/main.rs new file mode 100644 index 0000000..f9aef19 --- /dev/null +++ b/ex4_6/src/main.rs @@ -0,0 +1,41 @@ +pub struct Ticket { + title: String, + description: String, + status: String, +} + +impl Ticket { + fn title(&self) -> &str { + self.title.as_str() + } + + fn description(&self) -> &str { + self.description.as_str() + } + + fn status(&self) -> &str { + self.status.as_str() + } +} + +fn main() { + println!(""); +} + +#[cfg(test)] +mod tests { + use crate::*; + use std::any::{Any, TypeId}; + + #[test] + fn t0() { + let t = Ticket{ + title: String::from("t"), + description: String::from("d"), + status: String::from("s"), + }; + assert_eq!(TypeId::of::(), t.title().type_id()); + assert_eq!(TypeId::of::(), t.description().type_id()); + assert_eq!(TypeId::of::(), t.status().type_id()); + } +} -- cgit v1.2.3