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

Support numeric types (WAS 'Allow FromStr types') #14

Closed
birkenfeld opened this issue Nov 19, 2017 · 3 comments
Closed

Support numeric types (WAS 'Allow FromStr types') #14

birkenfeld opened this issue Nov 19, 2017 · 3 comments

Comments

@birkenfeld
Copy link

I'd propose to allow e.g. Result<i32, darling::Error> in the struct.

I'll submit a patch if you think this is a useful idea.

@TedDriggs
Copy link
Owner

I don't think your exact suggestion is possible without specialization, but if you can make it work I'd be happy to review a PR for it.

A much simpler approach would be adding thin FromMetaItem impls for the types you care about, wrapping their FromStr impls. Those would go in [core/src/from_meta_item.rs].

With those in place, the existing blanket impl FromMetaItem<T> for Result<T> would cover the case you're describing.

@TedDriggs
Copy link
Owner

@birkenfeld I've shipped v0.2.1, which has these impls added.

@TedDriggs TedDriggs changed the title Allow FromStr types Support numeric types (WAS 'Allow FromStr types') Nov 29, 2017
@birkenfeld
Copy link
Author

Sorry for not replying earlier. This is nice, thank you - I'll get back to you if I need FromMetaItem implemented for other types as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants