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

Looser trait bounds for Port types #247

Merged
merged 2 commits into from
Apr 30, 2021
Merged

Conversation

dbeckwith
Copy link
Contributor

@dbeckwith dbeckwith commented Apr 23, 2021

Using #[derive(Debug, Clone, PartialEq, Eq)] on the generic Port<T> types creates a bound on T which isn't necessary because the struct does not contain any values of type T. This isn't usually a problem because the only useful options for T (u8, u16, and u32) already implement these traits, but it can make it more annoying when working with other code that's generic over the port data type because you have to include these bounds. To fix this, I've manually implemented these traits without any bounds on T.

@dbeckwith dbeckwith changed the title Manually implement util traits for Port structs Looser trait bounds for Port types Apr 23, 2021
@phil-opp
Copy link
Member

Looks good to me, thank you! Let me know if I should merge this or if we should resolve #248 first.

@dbeckwith
Copy link
Contributor Author

You can merge this, I'll deal with the conflicts. Thanks!

@phil-opp phil-opp merged commit 63ef2ae into rust-osdev:master Apr 30, 2021
phil-opp added a commit that referenced this pull request Apr 30, 2021
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