@ -7,7 +7,11 @@ needing garbage collector. Therefore you must understand ownership in rust.
Create the following functions :
Create the following functions :
- `delete_and_backspace`, imagine that `-` represents the backspace key and the `+` represents the delete key, this function must receive a borrowed string and turn this string into the string without the backspaces and the deletes.
- `delete_and_backspace`, imagine that the `-` represents the `backspace key` and the `+` represents the `delete key`, this function must receive a borrowed string and turn this string into the string that applies the `backspaces` and the `deletes`.
- For example:
- "helll-o" turns into "hello"
- "he+lllo" turns into "hello"
- `is_correct` that borrows a Vector of string literals with some correct and incorrect math equations and replaces the correct equations with `✔` and the wrong with `✘` and returns a `usize` with the percentage of correct equations.
- `is_correct` that borrows a Vector of string literals with some correct and incorrect math equations and replaces the correct equations with `✔` and the wrong with `✘` and returns a `usize` with the percentage of correct equations.
Imagine you are working in a software to control smart lights in a house. You have access to an array of all the lights in a house.
Imagine you are working on a software to control smart lights in a house. You have access to an array of all the lights in a house.
Define the associated function `new` to the data structure `Light` which creates a new light with the alias passed in the arguments and a brightness of 0.
Define the associated **function**`new` to the data structure `Light` which creates a new light with the alias passed in the arguments and a brightness of 0.
Define the function `change_brightness` that receives a Vec of lights, an alias and a u8 value and sets the u8 value as the new brightness of the light identified by the alias in the Vec of lights.
Define the **function**`change_brightness` that receives a `Vec` of lights, an `alias` and a `u8`value. The **function** then sets the `u8` value as the new brightness of the light identified by the alias in the Vec of lights.
### Notions
[Example of Structs](https://doc.rust-lang.org/book/ch05-02-example-structs.html)