Skip to content

Commit 53cb846

Browse files
madaghaxxpedrodesu
andauthored
fix(rust-piscine): correct banner and drawing subjects (#3016)
* fixed a wrong data type given in the instructions but the expected function had it right * Fixed the main function and added an instruction --------- Co-authored-by: Pedro Ferreira <me.pedro.ferreira@gmail.com>
1 parent 977e708 commit 53cb846

2 files changed

Lines changed: 9 additions & 6 deletions

File tree

subjects/banner/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ println!("short hand: {}, long hand: {}, description: {}", d.short_hand, d.long_
2222

2323
An associated **type** called `Callback` will also be provided. It should represent a function pointer which is going to be used in the structure and functions below. This function will represent the callback for the flag associated to it.
2424

25-
A second structure named `FlagsHandler` will be given which just has one element: `flags: HashMap<(String, String), Callback>`. You'll also need to implement the following associated **functions**:
25+
A second structure named `FlagsHandler` will be given which just has one element: `flags: HashMap<String, Callback>`. You'll also need to implement the following associated **functions**:
2626

2727
- `add_flag`, which adds the flag and callback function to the HashMap.
2828
- `exec_func`, which executes the function using the flag provided and returns the result. The callback should be executed with the first two arguments of the supplied `argv` argument. Return either the successful result from the callback or the error stringified.

subjects/drawing/README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,14 @@ In order to compile and run `main.rs`, you'll need to define some structures. Yo
3030

3131
You'll also need to create the associated function `random` for `Line`, `Point` and `Circle`. You should derive their signatures from the usage.
3232

33+
Each shape must be drawn in a different color.
34+
3335
> Don't forget to add the dependencies in your Cargo.toml.
3436
3537
### Bonus
3638

3739
You may optionally implement the following shapes, including the structures and traits needed to draw them:
40+
3841
- `Pentagon`
3942
- `Cube`
4043

@@ -54,13 +57,13 @@ fn main() {
5457

5558
gs::Point::random(image.width, image.height).draw(&mut image);
5659

57-
let rectangle = gs::Rectangle::new(&gs::Point::new(150, 150), &gs::Point::new(50, 50));
60+
let rectangle = gs::Rectangle::new(&gs::Point::new(150, 300), &gs::Point::new(50, 60));
5861
rectangle.draw(&mut image);
5962

60-
let triangle = gs::Triangle::new (
61-
&gs::Point::new(500, 500),
62-
&gs::Point::new(250, 700),
63-
&gs::Point::new(700, 800),
63+
let triangle = gs::Triangle::new(
64+
&gs::Point::new(500, 500),
65+
&gs::Point::new(250, 700),
66+
&gs::Point::new(700, 800),
6467
);
6568
triangle.draw(&mut image);
6669

0 commit comments

Comments
 (0)