4 ms·
It may be easier to see their significance when they're associated with a trait, rather than a struct. For a simple example, imagine I've got a trait Number, a
by mikebenfield 9y ago
It may be easier to see their significance when they're associated with a trait, rather than a struct.
For a simple example, imagine I've got a trait Number, and every implementation of Number is supposed to have a zero constant. Then I could let that constant be Number::ZERO, and refer to it as such in generic code, with each implementation of Number having a different value for Number::ZERO.