diff options
| author | Brad Clawsie <brad@b7j0c.org> | 2026-11-03 14:09:53 -0600 |
|---|---|---|
| committer | Brad Clawsie <brad@b7j0c.org> | 2026-11-03 14:09:53 -0600 |
| commit | 30ec23ef1b843fabfde6433811a58316cb0155e0 (patch) | |
| tree | 61288fd51a81e0adc088878823d6ac9d4679124b | |
| parent | 5cc0f376ddecad94b4126dd508d0088582eba30f (diff) | |
feat: ex4_6
commit 24ee236d4750f0d7ee7bca005066d80f0e29c0d7
Author: Brad Clawsie <brad@b7j0c.org>
Date: Tue Nov 3 14:09:39 2026 -0600
feat: ex4_6
| -rw-r--r-- | ex4_6/Cargo.lock | 7 | ||||
| -rw-r--r-- | ex4_6/Cargo.toml | 6 | ||||
| -rw-r--r-- | ex4_6/src/main.rs | 41 |
3 files changed, 54 insertions, 0 deletions
diff --git a/ex4_6/Cargo.lock b/ex4_6/Cargo.lock new file mode 100644 index 0000000..681f226 --- /dev/null +++ b/ex4_6/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ex4_6" +version = "0.1.0" diff --git a/ex4_6/Cargo.toml b/ex4_6/Cargo.toml new file mode 100644 index 0000000..c6241bc --- /dev/null +++ b/ex4_6/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "ex4_6" +version = "0.1.0" +edition = "2024" + +[dependencies] 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::<str>(), t.title().type_id()); + assert_eq!(TypeId::of::<str>(), t.description().type_id()); + assert_eq!(TypeId::of::<str>(), t.status().type_id()); + } +} |
