completed 03/[00-07]
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user