Compare commits

..

No commits in common. "981a4778a9e452d143e9542a1eb8c8a60644c003" and "9e2ff7d037a3c72ccedb7818350e98baca445506" have entirely different histories.

5 changed files with 4 additions and 6 deletions

View file

@ -1,7 +1,7 @@
# Third-Party Exercises # Third-Party Exercises
The support of Rustlings for third-party exercises allows you to create your own set of Rustlings exercises to focus on some specific topic. The support of Rustlings for third-party exercises allows you to create your own set of Rustlings exercises to focus on some specific topic.
You could also offer a translation of the original Rustlings exercises as third-party exercises. You could also offer a translatation of the original Rustlings exercises as third-party exercises.
## Getting started ## Getting started

View file

@ -1,5 +1,5 @@
// 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.
#[derive(Debug)] #[derive(Debug)]
struct Package { struct Package {

View file

@ -4,7 +4,6 @@ fn placeholder() {}
fn string_slice(arg: &str) { fn string_slice(arg: &str) {
println!("{arg}"); println!("{arg}");
} }
fn string(arg: String) { fn string(arg: String) {
println!("{arg}"); println!("{arg}");
} }

View file

@ -39,8 +39,8 @@ struct PositiveNonzeroInteger(u64);
impl PositiveNonzeroInteger { impl PositiveNonzeroInteger {
fn new(value: i64) -> Result<PositiveNonzeroInteger, CreationError> { fn new(value: i64) -> Result<PositiveNonzeroInteger, CreationError> {
match value { match value {
x if x < 0 => Err(CreationError::Negative),
0 => Err(CreationError::Zero), 0 => Err(CreationError::Zero),
x if x < 0 => Err(CreationError::Negative),
x => Ok(PositiveNonzeroInteger(x as u64)), x => Ok(PositiveNonzeroInteger(x as u64)),
} }
} }

View file

@ -1,7 +1,6 @@
fn string_slice(arg: &str) { fn string_slice(arg: &str) {
println!("{arg}"); println!("{arg}");
} }
fn string(arg: String) { fn string(arg: String) {
println!("{arg}"); println!("{arg}");
} }