-
Notifications
You must be signed in to change notification settings - Fork 838
Open
Milestone
Description
Hi!
I was working on a project to generate nom parse functions using macros. But I'm running into the problem that automatically supporting floating numbers is hard, because of how the ParseTo trait is implemented. For example, the float function currently expects that ParseTo<f32> should be implemented. But to support this in my generic trait, every potential importer would need to add that constraint.
I think that the type R on ParseTo should not be on the trait itself, but on the function. Then the trait becomes easier to use. An improved version would look something like:
pub trait ParseTo {
fn parse_to<R: FromStr>(&self) -> Option<R>;
}
I'll work on a PR to open soon, so we can check the impact.
Metadata
Metadata
Assignees
Labels
No labels