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

Introduce derive macros #312

Closed
BabaBert opened this issue Mar 7, 2024 · 1 comment
Closed

Introduce derive macros #312

BabaBert opened this issue Mar 7, 2024 · 1 comment

Comments

@BabaBert
Copy link

BabaBert commented Mar 7, 2024

I think it would be quite neat to have derive macros for all num-traits and this shouldn't be breaking.

Use cases would mostly to write simple wrappers as such to make trait implementations easier down the line, but there could be other benefits from this as well:

#[derive(Float, FloatCore)
struct Float<F>(F) where F: Float + FloatCore;

#[derive(PrimInt)
struct Integer<I>(I) where F: PrimInt;

trait Foo{}

//not necessary to implement f32, f64 directly
impl<F> Foo for Float<F>{}

//same here for u8, i8, u16, ...
impl<I> Foo for Integer<I>{}
@cuviper
Copy link
Member

cuviper commented Mar 7, 2024

We do have num-derive, but not for generic types, as there are some open questions: rust-num/num-derive#37

@cuviper cuviper closed this as completed May 3, 2024
@cuviper cuviper closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2024
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

No branches or pull requests

2 participants