mirror of https://github.com/01-edu/public.git
docs(borrow_me_the_reference): correct example code
This commit is contained in:
parent
caa684eb13
commit
d232f3823e
|
@ -13,6 +13,7 @@ Create the following functions:
|
||||||
- `do_operations`: which borrows a Vector of string literals representing simple addition and subtraction equations. The function should replace the operation with the result.
|
- `do_operations`: which borrows a Vector of string literals representing simple addition and subtraction equations. The function should replace the operation with the result.
|
||||||
|
|
||||||
### Expected Functions
|
### Expected Functions
|
||||||
|
|
||||||
```rust
|
```rust
|
||||||
pub fn delete_and_backspace(s: &mut String) {
|
pub fn delete_and_backspace(s: &mut String) {
|
||||||
}
|
}
|
||||||
|
@ -30,7 +31,12 @@ use borrow_me_the_reference::{delete_and_backspace, do_operations};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let mut a = String::from("bpp--o+er+++sskroi-++lcw");
|
let mut a = String::from("bpp--o+er+++sskroi-++lcw");
|
||||||
let mut b: Vec<String> = vec!["2+2", "3+2", "10-3", "5+5"];
|
let mut b: Vec<String> = vec![
|
||||||
|
"2+2".to_string(),
|
||||||
|
"3+2".to_string(),
|
||||||
|
"10-3".to_string(),
|
||||||
|
"5+5".to_string(),
|
||||||
|
];
|
||||||
|
|
||||||
delete_and_backspace(&mut a);
|
delete_and_backspace(&mut a);
|
||||||
do_operations(&mut b);
|
do_operations(&mut b);
|
||||||
|
|
Loading…
Reference in New Issue