completed 03/[00-07]

This commit is contained in:
2025-02-24 15:53:03 +05:30
parent 7910a25928
commit 9161d08b1c
8 changed files with 116 additions and 25 deletions

View File

@@ -18,7 +18,23 @@ impl Ticket {
// as well as some `String` methods. Use the documentation of Rust's standard library
// to find the most appropriate options -> https://doc.rust-lang.org/std/string/struct.String.html
fn new(title: String, description: String, status: String) -> Self {
todo!();
if !(status.eq("To-Do") || status.eq("In Progress") || status.eq("Done")) {
panic!("Only `To-Do`, `In Progress`, and `Done` statuses are allowed");
}
if title.is_empty() {
panic!("Title cannot be empty")
}
if description.is_empty() {
panic!("Description cannot be empty")
}
if description.len() > 500 {
panic!("Description cannot be longer than 500 bytes");
}
if title.len() > 50 {
panic!("Title cannot be longer than 50 bytes");
}
Self {
title,
description,