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

Fix typos in code for embedded_graphics crate in chapter 3 #1269

Merged
merged 1 commit into from
Jan 28, 2024

Conversation

proudmuslim-dev
Copy link

@proudmuslim-dev proudmuslim-dev commented Jan 27, 2024

No description provided.

This still won't compile on account of the fact that the `Point` type apparently doesn't implement `Into<(usize, usize)>`. Attempting to change the type just results in more issues
// ignore any pixels that are out of bounds.
let (width, height) = {
let info = self.framebuffer.info();
(info.width, info.height)
}

if let Ok((x @ 0..width, y @ 0..height)) = coordinates.try_into() {
Copy link
Author

Choose a reason for hiding this comment

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

This still won't compile on account of the fact that the Point type apparently doesn't implement Into<(usize, usize)>. Attempting to change the type just results in more issues because the range values must be of the same integer type and have to be constants. The checks could of course be moved down but that would look much worse

Copy link
Author

Choose a reason for hiding this comment

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

I should also note that this syntax requires you to enable the experimental exclusive_range_pattern feature in order for it to be valid in the first place

Copy link
Owner

Choose a reason for hiding this comment

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

Thanks! This is already a good improvement, so let's merge this. I try my best to continue working on finishing the post soon.

@phil-opp phil-opp merged commit 2cf0675 into phil-opp:edition-3 Jan 28, 2024
2 of 5 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