Deriving MIN and MAX

I am defining a new type:
struct foo(i8);

Using derive and derive_more, I can derive everything I need except the MIN and MAX (i.e. the former i8::MIN and i8::MAX).

Is there a way to derive them also?

Not that I know of. While you could write your own macro, it really doesn't save much code compared to

impl Foo {
    const MIN: Foo = Foo(i8::MIN);
    const MAX: Foo = Foo(i8::MAX);
}

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.