mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
709 B
32 lines
709 B
1 year ago
|
use car_rental::*;
|
||
|
use std::cell::RefCell;
|
||
|
|
||
|
fn main() {
|
||
|
let car_rental = RentalBusiness {
|
||
|
car: RefCell::new(Car {
|
||
|
color: "red".to_string(),
|
||
|
plate: "AAA".to_string(),
|
||
|
}),
|
||
|
};
|
||
|
|
||
|
println!("{:?}", car_rental.rent_car());
|
||
|
println!("{:?}", car_rental.repair_car());
|
||
|
|
||
|
{
|
||
|
let mut car = car_rental.repair_car();
|
||
|
car.color = "blue".to_string();
|
||
|
}
|
||
|
|
||
|
println!("{:?}", car_rental.rent_car());
|
||
|
|
||
|
car_rental.change_car(Car {
|
||
|
color: "pink".to_string(),
|
||
|
plate: "WWW".to_string(),
|
||
|
});
|
||
|
|
||
|
println!("{:?}", car_rental.rent_car());
|
||
|
|
||
|
println!("{:?}", car_rental.sell_car());
|
||
|
println!("{:?}", car_rental.sell_car());
|
||
|
}
|