summaryrefslogtreecommitdiff
path: root/ex3_7/src/main.rs
diff options
context:
space:
mode:
authorBrad Clawsie <brad@b7j0c.org>2026-11-02 12:13:42 -0600
committerBrad Clawsie <brad@b7j0c.org>2026-11-02 12:13:42 -0600
commitdfdfb97810d3710cf1d9a44400ad70ac5833a38b (patch)
treec47a9d6381d7e64d48bebf2b56c7efdccfbaaf98 /ex3_7/src/main.rs
parent4b8b04e9e6a4e508b701622255065b28c8ccf3d0 (diff)
feat: ex3_7
commit 9e39b000d0a70d53b0d41a30aabd36b81e446ace Author: Brad Clawsie <brad@b7j0c.org> Date: Mon Nov 2 12:13:23 2026 -0600 feat: ex3_7
Diffstat (limited to 'ex3_7/src/main.rs')
-rw-r--r--ex3_7/src/main.rs51
1 files changed, 51 insertions, 0 deletions
diff --git a/ex3_7/src/main.rs b/ex3_7/src/main.rs
new file mode 100644
index 0000000..ac9ddb5
--- /dev/null
+++ b/ex3_7/src/main.rs
@@ -0,0 +1,51 @@
+pub struct Ticket {
+ title: String,
+ description: String,
+ status: String,
+}
+
+impl Ticket {
+ pub fn title(&self) -> String {
+ self.title.clone()
+ }
+
+ pub fn description(&self) -> String {
+ self.description.clone()
+ }
+
+ pub fn status(&self) -> String {
+ self.status.clone()
+ }
+
+ pub fn set_title(&mut self, title: &str) {
+ self.title = String::from(title);
+ }
+
+ pub fn set_description(&mut self, description: &str) {
+ self.description = String::from(description);
+ }
+
+ pub fn set_status(&mut self, status: &str) {
+ self.status = String::from(status);
+ }
+}
+
+fn main() {
+ println!("Hello, world!");
+}
+
+#[cfg(test)]
+mod tests {
+ use crate::*;
+
+ #[test]
+ fn t0() {
+ let mut t = Ticket{
+ title:String::from("title"),
+ description:String::from("desc"),
+ status:String::from("status"),
+ };
+ t.set_title("boo");
+ assert_eq!(t.title, "boo");
+ }
+}