We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fb7f25c commit 37dc6aeCopy full SHA for 37dc6ae
1 file changed
src/lib.rs
@@ -667,6 +667,15 @@ where
667
}
668
669
impl<T, N: ArrayLength> GenericArray<T, N> {
670
+ /// Returns the number of elements in the array.
671
+ ///
672
+ /// Equivalent to [`<N as Unsigned>::USIZE`](typenum::Unsigned) where `N` is the array length.
673
674
+ /// Useful for when only a type alias is available.
675
+ pub const fn len() -> usize {
676
+ N::USIZE
677
+ }
678
+
679
/// Extracts a slice containing the entire array.
680
#[inline(always)]
681
pub const fn as_slice(&self) -> &[T] {
0 commit comments