solution to exercise 03_01

This commit is contained in:
David Doblas Jiménez 2024-06-19 14:46:00 +02:00
parent 1d876eff10
commit 0e5cdc6d10

View File

@ -4,6 +4,16 @@
// //
// It should also have a method named `is_available` that returns a `true` if the quantity is // It should also have a method named `is_available` that returns a `true` if the quantity is
// greater than 0, otherwise `false`. // greater than 0, otherwise `false`.
struct Order {
price: u8,
quantity: u8,
}
impl Order {
fn is_available(self) -> bool {
self.quantity > 0
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {