Skip to content

Commit 21cb6ae

Browse files
committed
added struct
1 parent afbb531 commit 21cb6ae

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

exercises/03_ticket_v1/00_intro/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
fn intro() -> &'static str {
22
// TODO: fix me 👇
3-
"I'm ready to __!"
3+
"I'm ready to start modelling a software ticket!"
44
}
55

66
#[cfg(test)]

exercises/03_ticket_v1/01_struct/src/lib.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
// It should also have a method named `is_available` that returns a `true` if the quantity is
66
// greater than 0, otherwise `false`.
77

8+
struct Order {
9+
price: u32,
10+
quantity: u32,
11+
}
12+
13+
impl Order {
14+
fn is_available(self) -> bool {
15+
self.quantity > 0
16+
}
17+
}
18+
819
#[cfg(test)]
920
mod tests {
1021
use super::*;

0 commit comments

Comments
 (0)