solution to exercise 03_01
This commit is contained in:
parent
1d876eff10
commit
0e5cdc6d10
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user