Skip to content

Idiomatic Rust: Improve section on extension traits#3083

Merged
hurryabit merged 1 commit intomainfrom
ext-traits
Feb 7, 2026
Merged

Idiomatic Rust: Improve section on extension traits#3083
hurryabit merged 1 commit intomainfrom
ext-traits

Conversation

@hurryabit
Copy link
Collaborator

We make 3 changes:

  1. We make all code snippets editable. This makes it easier to play around with students' ideas.
  2. We add a main function to make the code exectable where it makes sense
  3. We move extension traits for str from &str to str. There is no need for the reference if the methods take &self.

@hurryabit hurryabit requested a review from gribozavr February 5, 2026 15:08
@hurryabit hurryabit enabled auto-merge (squash) February 5, 2026 15:09
We make 3 changes:
1.  We make all code snippets editable. This makes it easier to play
   around with students' ideas.
2.  We add a `main` function to make the code exectable where it makes
    sense
3.  We move extension traits for `str` from `&str` to `str`. There is no
    need for the reference if the methods take `&self`.
Copy link
Collaborator

@mgeisler mgeisler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Cc @tall-vase for future reference. It's critically important that the teacher can edit the code blocks so we can use them to answer questions while teaching. The class is about "showing, not telling" so we keep editing code blocks to show the students what we mean.

@hurryabit hurryabit merged commit 854de99 into main Feb 7, 2026
40 checks passed
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 this pull request may close these issues.

2 participants