diff --git a/subjects/organize_garage/README.md b/subjects/organize_garage/README.md new file mode 100644 index 00000000..1e159df7 --- /dev/null +++ b/subjects/organize_garage/README.md @@ -0,0 +1,44 @@ +## organize_garage + +### Instructions + +Create a structure `Garage` with generic values. It will have the following public fields: +- `left` as `Option`. +- `right` as `Option`. + +It will implement the following public methods: +- `move_to_right`: Moves the values from left to right. +- `move_to_left`: Moves the values from right to left. + +> The generic type will need to have `Add` and `Copy` traits implemented. It will also need to derive `Debug`. + +### Usage + +Here is a program to test your function. + +```rust +use organize_garage::*; + +fn main() { + let mut garage = Garage { + left: Some(5), + right: Some(2), + }; + + println!("{:?}", garage); + garage.move_to_right(); + println!("{:?}", garage); + garage.move_to_left(); + println!("{:?}", garage); +} +``` + +And its output + +```console +$ cargo run +Garage { left: Some(5), right: Some(2) } +Garage { left: None, right: Some(7) } +Garage { left: Some(7), right: None } +$ +```