Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structs3: relies on panic! which is not introduced in the official book until chapter 9 #685

Closed
bitmingw opened this issue Mar 27, 2021 · 3 comments

Comments

@bitmingw
Copy link

The exercise of Structs3 requires knowledge of panic! to complete the task.

    fn new(sender_country: String, recipient_country: String, weight_in_grams: i32) -> Package {
        if weight_in_grams <= 0 {
            // Something goes here...
        } else {
            return Package {
                sender_country,
                recipient_country,
                weight_in_grams,
            };
        }
    }

However panic! is not introduced in the official book until chapter 9 (Error Handling), so user who closely follows the book and does exercise will have additional challenge to find the right answer here.

Maybe we should just provide the panic! implementation here instead of asking user to find it?

@carneeki
Copy link

Agree, having the user implement the new package (and perhaps seeing the panic! but not needing to implement it) is probably more inline with a lesson about structs.

@VMois
Copy link

VMois commented Sep 12, 2021

Agree. Needed to search how to panic!. Would be good to introduce panic earlier or to provide an implementation for it (the second option sounds better).

@thephet
Copy link

thephet commented Oct 5, 2021

Hi, I am doing the exercises as a noob, and this needs to be fixed. No idea what I am supposed to do.

camperdue42 added a commit to camperdue42/rustlings that referenced this issue Dec 31, 2021
dmoore04 pushed a commit to dmoore04/rustlings that referenced this issue Sep 11, 2022
Spacebody pushed a commit to Spacebody/my-rustlings that referenced this issue Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants