You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Btw constants as field might still be useful. For example, if we want to track the bit number of something and only perform mod reductions or range checks when the bits get too large
Generic struct only can simplify repeated code, but also it is necessary when we want to use struct field to instantiate a generic method.
For example:
With support of generic struct, struct
Uint8
can be generalized asUint<bit_len>
generic over the size of bit len.Also the
self.bit_len
can be treated as a immutable constant so it can be as a constant argument to instantiate a generic function.The text was updated successfully, but these errors were encountered: