solution to exercise 03_04
This commit is contained in:
parent
d3b4c0d653
commit
1c16ac8c22
@ -1,12 +1,12 @@
|
|||||||
mod ticket {
|
mod ticket {
|
||||||
struct Ticket {
|
pub struct Ticket {
|
||||||
title: String,
|
title: String,
|
||||||
description: String,
|
description: String,
|
||||||
status: String,
|
status: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Ticket {
|
impl Ticket {
|
||||||
fn new(title: String, description: String, status: String) -> Ticket {
|
pub fn new(title: String, description: String, status: String) -> Ticket {
|
||||||
if title.is_empty() {
|
if title.is_empty() {
|
||||||
panic!("Title cannot be empty");
|
panic!("Title cannot be empty");
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ mod tests {
|
|||||||
//
|
//
|
||||||
// TODO: Once you have verified that the below does not compile,
|
// TODO: Once you have verified that the below does not compile,
|
||||||
// comment the line out to move on to the next exercise!
|
// comment the line out to move on to the next exercise!
|
||||||
assert_eq!(ticket.description, "A description");
|
// assert_eq!(ticket.description, "A description");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn encapsulation_cannot_be_violated() {
|
fn encapsulation_cannot_be_violated() {
|
||||||
@ -68,10 +68,10 @@ mod tests {
|
|||||||
//
|
//
|
||||||
// TODO: Once you have verified that the below does not compile,
|
// TODO: Once you have verified that the below does not compile,
|
||||||
// comment the lines out to move on to the next exercise!
|
// comment the lines out to move on to the next exercise!
|
||||||
let ticket = Ticket {
|
// let ticket = Ticket {
|
||||||
title: "A title".into(),
|
// title: "A title".into(),
|
||||||
description: "A description".into(),
|
// description: "A description".into(),
|
||||||
status: "To-Do".into(),
|
// status: "To-Do".into(),
|
||||||
};
|
// };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user