docs(exercises): consistent exercise description
This commit is contained in:
parent
86dccc4ca7
commit
1a4aff442a
|
@ -1,9 +1,13 @@
|
||||||
// if1.rs
|
// if1.rs
|
||||||
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint if1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
pub fn bigger(a: i32, b: i32) -> i32 {
|
pub fn bigger(a: i32, b: i32) -> i32 {
|
||||||
// Complete this function to return the bigger number!
|
// TODO: Complete this function to return the bigger number!
|
||||||
// Do not use:
|
// Do not use:
|
||||||
// - another function call
|
// - another function call
|
||||||
// - additional variables
|
// - additional variables
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
// if2.rs
|
// if2.rs
|
||||||
|
//
|
||||||
// Step 1: Make me compile!
|
// Step 1: Make me compile!
|
||||||
// Step 2: Get the bar_for_fuzz and default_to_baz tests passing!
|
// Step 2: Get the bar_for_fuzz and default_to_baz tests passing!
|
||||||
// Execute the command `rustlings hint if2` if you want a hint :)
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint if2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// macros1.rs
|
// macros1.rs
|
||||||
// Make me compile! Execute `rustlings hint macros1` for hints :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint macros1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// macros2.rs
|
// macros2.rs
|
||||||
// Make me compile! Execute `rustlings hint macros2` for hints :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint macros2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// macros3.rs
|
// macros3.rs
|
||||||
|
//
|
||||||
// Make me compile, without taking the macro out of the module!
|
// Make me compile, without taking the macro out of the module!
|
||||||
// Execute `rustlings hint macros3` for hints :)
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint macros3
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// macros4.rs
|
// macros4.rs
|
||||||
// Make me compile! Execute `rustlings hint macros4` for hints :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint macros4
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// modules1.rs
|
// modules1.rs
|
||||||
// Make me compile! Execute `rustlings hint modules1` for hints :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint modules1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// modules2.rs
|
// modules2.rs
|
||||||
// Make me compile! Execute `rustlings hint modules2` for hints :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint modules2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// move_semantics1.rs
|
// move_semantics1.rs
|
||||||
// Make me compile! Execute `rustlings hint move_semantics1` for hints :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint move_semantics1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// move_semantics2.rs
|
// move_semantics2.rs
|
||||||
|
//
|
||||||
// Make me compile without changing line 13!
|
// Make me compile without changing line 13!
|
||||||
// Execute `rustlings hint move_semantics2` for hints :)
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint move_semantics2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
// move_semantics3.rs
|
// move_semantics3.rs
|
||||||
|
//
|
||||||
// Make me compile without adding new lines-- just changing existing lines!
|
// Make me compile without adding new lines-- just changing existing lines!
|
||||||
// (no lines with multiple semicolons necessary!)
|
// (no lines with multiple semicolons necessary!)
|
||||||
// Execute `rustlings hint move_semantics3` for hints :)
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint move_semantics3
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// move_semantics4.rs
|
// move_semantics4.rs
|
||||||
|
//
|
||||||
// Refactor this code so that instead of having `vec0` and creating the vector
|
// Refactor this code so that instead of having `vec0` and creating the vector
|
||||||
// in `fn main`, we create it within `fn fill_vec` and transfer the
|
// in `fn main`, we create it within `fn fill_vec` and transfer the
|
||||||
// freshly created vector from fill_vec to its caller.
|
// freshly created vector from fill_vec to its caller.
|
||||||
// Execute `rustlings hint move_semantics4` for hints!
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint move_semantics4
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
// option1.rs
|
// option1.rs
|
||||||
// Make me compile! Execute `rustlings hint option1` for hints
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint option1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
// you can modify anything EXCEPT for this function's sig
|
// You can modify anything EXCEPT for this function's sig
|
||||||
fn print_number(maybe_number: Option<u16>) {
|
fn print_number(maybe_number: Option<u16>) {
|
||||||
println!("printing: {}", maybe_number.unwrap());
|
println!("printing: {}", maybe_number.unwrap());
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// option2.rs
|
// option2.rs
|
||||||
// Make me compile! Execute `rustlings hint option2` for hints
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint option2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
// primitive_types1.rs
|
// primitive_types1.rs
|
||||||
|
//
|
||||||
// Fill in the rest of the line that has code missing!
|
// Fill in the rest of the line that has code missing!
|
||||||
// No hints, there's no tricks, just get used to typing these :)
|
// No hints, there's no tricks, just get used to typing these :)
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
// primitive_types2.rs
|
// primitive_types2.rs
|
||||||
|
//
|
||||||
// Fill in the rest of the line that has code missing!
|
// Fill in the rest of the line that has code missing!
|
||||||
// No hints, there's no tricks, just get used to typing these :)
|
// No hints, there's no tricks, just get used to typing these :)
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// primitive_types3.rs
|
// primitive_types3.rs
|
||||||
|
//
|
||||||
// Create an array with at least 100 elements in it where the ??? is.
|
// Create an array with at least 100 elements in it where the ??? is.
|
||||||
// Execute `rustlings hint primitive_types3` for hints!
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint primitive_types3
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// primitive_types4.rs
|
// primitive_types4.rs
|
||||||
|
//
|
||||||
// Get a slice out of Array a where the ??? is so that the test passes.
|
// Get a slice out of Array a where the ??? is so that the test passes.
|
||||||
// Execute `rustlings hint primitive_types4` for hints!!
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint primitive_types4
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// primitive_types5.rs
|
// primitive_types5.rs
|
||||||
|
//
|
||||||
// Destructure the `cat` tuple so that the println will work.
|
// Destructure the `cat` tuple so that the println will work.
|
||||||
// Execute `rustlings hint primitive_types5` for hints!
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint primitive_types5
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
// primitive_types6.rs
|
// primitive_types6.rs
|
||||||
|
//
|
||||||
// Use a tuple index to access the second element of `numbers`.
|
// Use a tuple index to access the second element of `numbers`.
|
||||||
// You can put the expression for the second element where ??? is so that the test passes.
|
// You can put the expression for the second element where ??? is so that the test passes.
|
||||||
// Execute `rustlings hint primitive_types6` for hints!
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint primitive_types6
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,21 @@
|
||||||
// quiz1.rs
|
// quiz1.rs
|
||||||
// This is a quiz for the following sections:
|
//
|
||||||
|
// This quiz covers the sections:
|
||||||
// - Variables
|
// - Variables
|
||||||
// - Functions
|
// - Functions
|
||||||
|
//
|
||||||
// Mary is buying apples. One apple usually costs 2 Rustbucks, but if you buy
|
// Mary is buying apples. One apple usually costs 2 Rustbucks, but if you buy
|
||||||
// more than 40 at once, each apple only costs 1! Write a function that calculates
|
// more than 40 at once, each apple only costs 1! Write a function that calculates
|
||||||
// the price of an order of apples given the order amount. No hints this time!
|
// the price of an order of apples given the order amount.
|
||||||
|
//
|
||||||
|
// No hints this time :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
// Put your function here!
|
// Put your function here!
|
||||||
// fn ..... {
|
// fn ..... {
|
||||||
|
|
||||||
// Don't modify this function!
|
// Don't modify this test function!
|
||||||
#[test]
|
#[test]
|
||||||
fn verify_test() {
|
fn verify_test() {
|
||||||
let price1 = calculate_apple_price(35);
|
let price1 = calculate_apple_price(35);
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
// quiz2.rs
|
// quiz2.rs
|
||||||
// This is a quiz for the following sections:
|
//
|
||||||
|
// This quiz covers the sections:
|
||||||
// - Strings
|
// - Strings
|
||||||
|
//
|
||||||
// Ok, here are a bunch of values-- some are `String`s, some are `&str`s. Your
|
// Ok, here are a bunch of values-- some are `String`s, some are `&str`s. Your
|
||||||
// task is to call one of these two functions on each value depending on what
|
// task is to call one of these two functions on each value depending on what
|
||||||
// you think each value is. That is, add either `string_slice` or `string`
|
// you think each value is. That is, add either `string_slice` or `string`
|
||||||
// before the parentheses on each line. If you're right, it will compile!
|
// before the parentheses on each line. If you're right, it will compile!
|
||||||
|
//
|
||||||
|
// No hints this time :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,13 @@
|
||||||
// quiz3.rs
|
// quiz3.rs
|
||||||
// This is a quiz for the following sections:
|
//
|
||||||
|
// This quiz covers the sections:
|
||||||
// - Tests
|
// - Tests
|
||||||
|
//
|
||||||
// This quiz isn't testing our function -- make it do that in such a way that
|
// This quiz isn't testing our function -- make it do that in such a way that
|
||||||
// the test passes. Then write a second test that tests that we get the result
|
// the test passes. Then write a second test that tests that we get the result
|
||||||
// we expect to get when we call `times_two` with a negative number.
|
// we expect to get when we call `times_two` with a negative number.
|
||||||
// No hints, you can do this :)
|
//
|
||||||
|
// No hints this time :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
@ -24,7 +26,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn returns_twice_of_negative_numbers() {
|
fn returns_twice_of_negative_numbers() {
|
||||||
// TODO replace unimplemented!() with an assert for `times_two(-4)`
|
// TODO: replace unimplemented!() with an assert for `times_two(-4)`
|
||||||
unimplemented!()
|
unimplemented!()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
// quiz4.rs
|
// quiz4.rs
|
||||||
|
//
|
||||||
// This quiz covers the sections:
|
// This quiz covers the sections:
|
||||||
// - Modules
|
// - Modules
|
||||||
// - Macros
|
// - Macros
|
||||||
|
//
|
||||||
// Write a macro that passes the quiz! No hints this time, you can do it!
|
// Write a macro that passes the quiz! No hints this time, you can do it!
|
||||||
|
//
|
||||||
|
// No hints this time :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// arc1.rs
|
// arc1.rs
|
||||||
|
//
|
||||||
// In this exercise, we are given a Vec of u32 called "numbers" with values ranging
|
// In this exercise, we are given a Vec of u32 called "numbers" with values ranging
|
||||||
// from 0 to 99 -- [ 0, 1, 2, ..., 98, 99 ]
|
// from 0 to 99 -- [ 0, 1, 2, ..., 98, 99 ]
|
||||||
// We would like to use this set of numbers within 8 different threads simultaneously.
|
// We would like to use this set of numbers within 8 different threads simultaneously.
|
||||||
|
@ -8,15 +9,15 @@
|
||||||
// The third thread (offset 2), will sum 2, 10, 18, ...
|
// The third thread (offset 2), will sum 2, 10, 18, ...
|
||||||
// ...
|
// ...
|
||||||
// The eighth thread (offset 7), will sum 7, 15, 23, ...
|
// The eighth thread (offset 7), will sum 7, 15, 23, ...
|
||||||
|
//
|
||||||
// Because we are using threads, our values need to be thread-safe. Therefore,
|
// Because we are using threads, our values need to be thread-safe. Therefore,
|
||||||
// we are using Arc. We need to make a change in each of the two TODOs.
|
// we are using Arc. We need to make a change in each of the two TODOs.
|
||||||
|
//
|
||||||
|
|
||||||
// Make this code compile by filling in a value for `shared_numbers` where the
|
// Make this code compile by filling in a value for `shared_numbers` where the
|
||||||
// first TODO comment is, and create an initial binding for `child_numbers`
|
// first TODO comment is, and create an initial binding for `child_numbers`
|
||||||
// where the second TODO comment is. Try not to create any copies of the `numbers` Vec!
|
// where the second TODO comment is. Try not to create any copies of the `numbers` Vec!
|
||||||
// Execute `rustlings hint arc1` for hints :)
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint arc1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
//
|
//
|
||||||
// Note: the tests should not be changed
|
// Note: the tests should not be changed
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint box1` for hints :)
|
// If you need help, open the corresponding README.md or run: rustlings hint box1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
// This module helps you get familiar with the structure of using an iterator and
|
// This module helps you get familiar with the structure of using an iterator and
|
||||||
// how to go through elements within an iterable collection.
|
// how to go through elements within an iterable collection.
|
||||||
//
|
//
|
||||||
// Execute `rustlings hint iterators1` for hints :D
|
// If you need help, open the corresponding README.md or run: rustlings hint iterators1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
// iterators2.rs
|
// iterators2.rs
|
||||||
|
//
|
||||||
// In this exercise, you'll learn some of the unique advantages that iterators
|
// In this exercise, you'll learn some of the unique advantages that iterators
|
||||||
// can offer. Follow the steps to complete the exercise.
|
// can offer. Follow the steps to complete the exercise.
|
||||||
// As always, there are hints if you execute `rustlings hint iterators2`!
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint iterators2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
// iterators3.rs
|
// iterators3.rs
|
||||||
|
//
|
||||||
// This is a bigger exercise than most of the others! You can do it!
|
// This is a bigger exercise than most of the others! You can do it!
|
||||||
// Here is your mission, should you choose to accept it:
|
// Here is your mission, should you choose to accept it:
|
||||||
// 1. Complete the divide function to get the first four tests to pass.
|
// 1. Complete the divide function to get the first four tests to pass.
|
||||||
// 2. Get the remaining tests to pass by completing the result_with_list and
|
// 2. Get the remaining tests to pass by completing the result_with_list and
|
||||||
// list_of_results functions.
|
// list_of_results functions.
|
||||||
// Execute `rustlings hint iterators3` to get some hints!
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint iterators3
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
// iterators4.rs
|
// iterators4.rs
|
||||||
|
//
|
||||||
|
// Make the tests pass!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint iterators4
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
pub fn factorial(num: u64) -> u64 {
|
pub fn factorial(num: u64) -> u64 {
|
||||||
// Complete this function to return the factorial of num
|
// TODO: Complete this function to return the factorial of num
|
||||||
// Do not use:
|
// Do not use:
|
||||||
// - return
|
// - return
|
||||||
// Try not to use:
|
// Try not to use:
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// iterators5.rs
|
// iterators5.rs
|
||||||
|
//
|
||||||
// Let's define a simple model to track Rustlings exercise progress. Progress
|
// Let's define a simple model to track Rustlings exercise progress. Progress
|
||||||
// will be modelled using a hash map. The name of the exercise is the key and
|
// will be modelled using a hash map. The name of the exercise is the key and
|
||||||
// the progress is the value. Two counting functions were created to count the
|
// the progress is the value. Two counting functions were created to count the
|
||||||
|
@ -7,10 +7,10 @@
|
||||||
// imperative style for loops. Recreate this counting functionality using
|
// imperative style for loops. Recreate this counting functionality using
|
||||||
// iterators. Only the two iterator methods (count_iterator and
|
// iterators. Only the two iterator methods (count_iterator and
|
||||||
// count_collection_iterator) need to be modified.
|
// count_collection_iterator) need to be modified.
|
||||||
// Execute `rustlings hint
|
|
||||||
// iterators5` for hints.
|
|
||||||
//
|
//
|
||||||
// Make the code compile and the tests pass.
|
// Make the code compile and the tests pass.
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint iterators5
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// strings1.rs
|
// strings1.rs
|
||||||
|
//
|
||||||
// Make me compile without changing the function signature!
|
// Make me compile without changing the function signature!
|
||||||
// Execute `rustlings hint strings1` for hints ;)
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint strings1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
// strings2.rs
|
// strings2.rs
|
||||||
|
//
|
||||||
// Make me compile without changing the function signature!
|
// Make me compile without changing the function signature!
|
||||||
// Execute `rustlings hint strings2` for hints :)
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint strings2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// structs1.rs
|
// structs1.rs
|
||||||
|
//
|
||||||
// Address all the TODOs to make the tests pass!
|
// Address all the TODOs to make the tests pass!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint structs1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// structs2.rs
|
// structs2.rs
|
||||||
|
//
|
||||||
// Address all the TODOs to make the tests pass!
|
// Address all the TODOs to make the tests pass!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint structs2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// structs3.rs
|
// structs3.rs
|
||||||
|
//
|
||||||
// Structs contain data, but can also have logic. In this exercise we have
|
// Structs contain data, but can also have logic. In this exercise we have
|
||||||
// defined the Package struct and we want to test some logic attached to it.
|
// defined the Package struct and we want to test some logic attached to it.
|
||||||
// Make the code compile and the tests pass!
|
// Make the code compile and the tests pass!
|
||||||
// If you have issues execute `rustlings hint structs3`
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint structs3
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
// tests1.rs
|
// tests1.rs
|
||||||
|
//
|
||||||
// Tests are important to ensure that your code does what you think it should do.
|
// Tests are important to ensure that your code does what you think it should do.
|
||||||
// Tests can be run on this file with the following command:
|
// Tests can be run on this file with the following command:
|
||||||
// rustlings run tests1
|
// rustlings run tests1
|
||||||
|
//
|
||||||
// This test has a problem with it -- make the test compile! Make the test
|
// This test has a problem with it -- make the test compile! Make the test
|
||||||
// pass! Make the test fail! Execute `rustlings hint tests1` for hints :)
|
// pass! Make the test fail!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint tests1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
// tests2.rs
|
// tests2.rs
|
||||||
|
//
|
||||||
// This test has a problem with it -- make the test compile! Make the test
|
// This test has a problem with it -- make the test compile! Make the test
|
||||||
// pass! Make the test fail! Execute `rustlings hint tests2` for hints :)
|
// pass! Make the test fail!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint tests2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
// tests3.rs
|
// tests3.rs
|
||||||
|
//
|
||||||
// This test isn't testing our function -- make it do that in such a way that
|
// This test isn't testing our function -- make it do that in such a way that
|
||||||
// the test passes. Then write a second test that tests whether we get the result
|
// the test passes. Then write a second test that tests whether we get the result
|
||||||
// we expect to get when we call `is_even(5)`.
|
// we expect to get when we call `is_even(5)`.
|
||||||
// Execute `rustlings hint tests3` for hints :)
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint tests3
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,13 @@
|
||||||
// threads1.rs
|
// threads1.rs
|
||||||
// Make this compile! Execute `rustlings hint threads1` for hints :)
|
//
|
||||||
// The idea is the thread spawned on line 22 is completing jobs while the main thread is
|
// The idea is the thread spawned on line 22 is completing jobs while the main thread is
|
||||||
// monitoring progress until 10 jobs are completed. Because of the difference between the
|
// monitoring progress until 10 jobs are completed. Because of the difference between the
|
||||||
// spawned threads' sleep time, and the waiting threads sleep time, when you see 6 lines
|
// spawned threads' sleep time, and the waiting threads sleep time, when you see 6 lines
|
||||||
// of "waiting..." and the program ends without timing out when running,
|
// of "waiting..." and the program ends without timing out when running,
|
||||||
// you've got it :)
|
// you've got it :)
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint threads1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
// traits1.rs
|
// traits1.rs
|
||||||
|
//
|
||||||
// Time to implement some traits!
|
// Time to implement some traits!
|
||||||
//
|
//
|
||||||
// Your task is to implement the trait
|
// Your task is to implement the trait
|
||||||
|
@ -7,6 +8,8 @@
|
||||||
// The trait AppendBar has only one function,
|
// The trait AppendBar has only one function,
|
||||||
// which appends "Bar" to any object
|
// which appends "Bar" to any object
|
||||||
// implementing this trait.
|
// implementing this trait.
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint traits1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
@ -15,7 +18,7 @@ trait AppendBar {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AppendBar for String {
|
impl AppendBar for String {
|
||||||
//Add your code here
|
// Add your code here
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
//
|
//
|
||||||
// No boiler plate code this time,
|
// No boiler plate code this time,
|
||||||
// you can do this!
|
// you can do this!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint traits2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
@ -16,7 +18,7 @@ trait AppendBar {
|
||||||
fn append_bar(self) -> Self;
|
fn append_bar(self) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Add your code here
|
// TODO: Add your code here
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
// variables1.rs
|
// variables1.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables1` if you want a hint :)
|
//
|
||||||
|
|
||||||
// About this `I AM NOT DONE` thing:
|
// About this `I AM NOT DONE` thing:
|
||||||
// We sometimes encourage you to keep trying things on a given exercise,
|
// We sometimes encourage you to keep trying things on a given exercise,
|
||||||
// even after you already figured it out. If you got everything working and
|
// even after you already figured it out. If you got everything working and
|
||||||
// feel ready for the next exercise, remove the `I AM NOT DONE` comment below.
|
// feel ready for the next exercise, remove the `I AM NOT DONE` comment below.
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint variables1
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// variables2.rs
|
// variables2.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables2` if you want a hint :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint variables2
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// variables3.rs
|
// variables3.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables3` if you want a hint :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint variables3
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// variables4.rs
|
// variables4.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables4` if you want a hint :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint variables4
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// variables5.rs
|
// variables5.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables5` if you want a hint :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint variables5
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
// variables6.rs
|
// variables6.rs
|
||||||
// Make me compile! Execute the command `rustlings hint variables6` if you want a hint :)
|
//
|
||||||
|
// Make me compile!
|
||||||
|
//
|
||||||
|
// If you need help, open the corresponding README.md or run: rustlings hint variables6
|
||||||
|
|
||||||
// I AM NOT DONE
|
// I AM NOT DONE
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue