-
Notifications
You must be signed in to change notification settings - Fork 183
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
Move CodePointTrie to components/utils #1114
Conversation
pub struct CodePointTrie<'trie, W: ValueWidth, T: TrieType> { | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
pub struct CodePointTrie<'trie, W: ValueWidth> | ||
where <<W as AsULE>::ULE as ULE>::Error: Display |
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.
One of the compiler errors was that, as I understood it, the default implementation of Serde provided by the derive required that the Error type implement std::fmt::Display
, but instead, the added trait bound uses core::fmt::Display
. Is that ok?
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.
We should avoid putting trait bounds on the struct. Trait bounds belong on impls. Serde complaining isn't a good reason to put a trait bound on a struct. Manish shared a really good article on the subject last week: https://stackoverflow.com/questions/49229332/should-trait-bounds-be-duplicated-in-struct-and-impl/66369912#66369912
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.
LGTM
CC @Manishearth who may want to review this |
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.
Seems good to me! Losing the TrieType enum looks much nicer
Closes #1070
Done so far in this PR: