Closed bigdogs closed 1 year ago
and is there a method to get the array length from GenericArray? If try_from
is not possible to support, I can check slice size before 'GenericArray::from_slice', But I didn't find any method for this.
I do this outside the crate:
let arr: [u8; 32] = some_vec.try_from()?;
let genarr = GenericArray::from(arr);
There is also from_exact_iter that will return None
if the sizes don't match.
GenericArray::from_slice(&[u8) will panic if slice length is not match. It would be great to provide a Result version, e.g. (GenericArray::try_from_slice(&[u8) -> Result<Self, LengthNotMatch>)