-
Notifications
You must be signed in to change notification settings - Fork 6
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
no_std #7
no_std #7
Conversation
Removed `Debug` and `PartialEq` from `Location` bounds.
Thanks for your PR! I've added back the location bounds (PartialEq and Debug) for now; the original reason for PartialEq existing was so that somebody could always compare two locations to see if they are the same, and Debug seems useful for debugging locations. But I'll have a think; maybe removing them makes more sense because people can enforce them again if needed with their own blanket trait or something like that, and as you noted they aren't needed in the library or examples. But for now let's just get no-std in :) |
Generic bounds (such as |
Probably the main/only reason for the extra bounds is just user friendliness; ie somebody can write a function that takes an I def understand the desire to be more precise in the bounds and make these things opt-in instead though, so probably there's a nice way to meet in the middle; maybe just something like "write a blanket trait impl to add any extra bounds" with an example of this. When I have time I'll think about it more; currently travelling! |
pub trait DebugTokens: Tokens
where
Self::Location: PartialEq + Debug + Clone,
{
}
impl<T> DebugTokens for T
where
T: Tokens,
T::Location: PartialEq + Debug + Clone,
{
} and encountered this issue: rust-lang/rust#20671. Something to note if you attempt similarly. fn f(toks: &mut impl Tokens<Item = char>) {
/* content */
} becomes fn f(toks: &mut impl Tokens<Item = char, Location = impl PartialEq + Debug + Clone>) {
/* content */
} in the places where that restriction was actually needed. fn f(toks: &mut impl Tokens<Item = char, Location = impl Clone>) {
/* content */
} at this point I could see the argument that |
Removed unnecessary bounds on
Location
and implemented no_std compatibility.