File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,22 @@ pub unsafe trait ArraySize: Unsigned {
3636 + IntoIterator < Item = T > ;
3737}
3838
39- /// Associates an [`ArraySize`] with a given type.
39+ /// Associates an [`ArraySize`] with a given type. Can be used to write APIs which use `[T; N]`
40+ /// and convert to [`Array`] internally.
41+ ///
42+ /// # Example
43+ ///
44+ /// ```
45+ /// use hybrid_array::{ArrayN, AssocArraySize};
46+ ///
47+ /// pub fn example<const N: usize>(bytes: &[u8; N])
48+ /// where
49+ /// [u8; N]: AssocArraySize + AsRef<ArrayN<u8, N>>
50+ /// {
51+ /// // _arrayn is ArrayN<u8, N>
52+ /// let _arrayn = bytes.as_ref();
53+ /// }
54+ /// ```
4055pub trait AssocArraySize : Sized {
4156 /// Size of an array type, expressed as a [`typenum`]-based [`ArraySize`].
4257 type Size : ArraySize ;
You can’t perform that action at this time.
0 commit comments