-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Use safe-mmio crate in PL011 UART driver example and RTC exercise solution #2752
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
base: main
Are you sure you want to change the base?
Conversation
d150008
to
b583093
Compare
861086f
to
dfc78c0
Compare
A question that comes to mind is why? I see that you're replacing some raw pointers and hand-written structs with something from a new crate. What is the benefit? Put differently, before, I could reason about the code directly. Now, I need to know something about the two crates that are in use. So it almost seems like a step back from a pedagogical point of view? |
Ah, I read a bit more and it seems that this allows one to avoid calling unsafe methods? That's of course nice. Would it be useful to show students both the hand-written version we have used up until now, and also the nice abstracted version you have in this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feel free to merge since I understand that you would like to show people how safe and nice the API can be. But consider the learning opportunity of hand-writing the more low-level approach as well.
True, using I think this is a tricky balance we have in a lot of the course, between teaching the fundamentals of how the Rust language works, and showing the practical side of how to write good idiomatic Rust code. I'm inclined to have more of the latter, as people are going to go away from this course to work on new projects in Rust, sometimes without an experienced Rust developer on their team, and so I think it's important to set them up to write good Rust code right away. One option I considered was to keep the old version as a step along the way, and then have another slide where we go through and refactor it to an improved version using |
No description provided.