Browse Source

clarifications and notions

content-update
Chris 3 years ago
parent
commit
cb8e2ab297
  1. 6
      subjects/borrow_me_the_reference/README.md
  2. 13
      subjects/changes/README.md

6
subjects/borrow_me_the_reference/README.md

@ -7,7 +7,11 @@ needing garbage collector. Therefore you must understand ownership in rust.
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.

13
subjects/changes/README.md

@ -2,11 +2,16 @@
### Instructions
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)
[Keyword Self](https://doc.rust-lang.org/std/keyword.Self.html)
### Expected Functions and Structure
@ -31,6 +36,8 @@ pub fn change_brightness(lights: &mut Vec<Light>, alias: &str, value: u8) {
Here is an incomplete program to test your function
```rust
use changes::*;
fn main() {
// bedroom
let mut lights = vec![

Loading…
Cancel
Save