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 {
36
36
+ IntoIterator < Item = T > ;
37
37
}
38
38
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
+ /// ```
40
55
pub trait AssocArraySize : Sized {
41
56
/// Size of an array type, expressed as a [`typenum`]-based [`ArraySize`].
42
57
type Size : ArraySize ;
You can’t perform that action at this time.
0 commit comments