Closed agostbiro closed 2 years ago
ArrayLength
type values are required to also implement typenum::Unsigned
as per the trait definition, and Unsigned
can provide a variety of associated constants and methods to get it as a regular integer value.
use generic_array::{ArrayLength, typenum::Unsigned}; // typenum is re-exported in generic_array
let size = <FieldSize<Curve> as Unsigned>::USIZE; // or ::to_usize()
Great, that's exactly what I was looking for. Thanks a lot for the quick answer!
Hi,
First of all, thanks for the library! I'm wondering if there is a way to get a
usize
from anArrayLength
without constructing an array. Currently I'm doing this:I've looked through the source but couldn't find a better way. I'm wondering if I'm missing something?