summaryrefslogtreecommitdiff
path: root/ex4_6/src
diff options
context:
space:
mode:
authorBrad Clawsie <brad@b7j0c.org>2026-11-03 14:09:53 -0600
committerBrad Clawsie <brad@b7j0c.org>2026-11-03 14:09:53 -0600
commit30ec23ef1b843fabfde6433811a58316cb0155e0 (patch)
tree61288fd51a81e0adc088878823d6ac9d4679124b /ex4_6/src
parent5cc0f376ddecad94b4126dd508d0088582eba30f (diff)
feat: ex4_6
commit 24ee236d4750f0d7ee7bca005066d80f0e29c0d7 Author: Brad Clawsie <brad@b7j0c.org> Date: Tue Nov 3 14:09:39 2026 -0600 feat: ex4_6
Diffstat (limited to 'ex4_6/src')
-rw-r--r--ex4_6/src/main.rs41
1 files changed, 41 insertions, 0 deletions
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());
+ }
+}