We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 97eb3fd commit c321bf2Copy full SHA for c321bf2
src/array.rs
@@ -15,9 +15,11 @@
15
pub unsafe trait Array {
16
/// The array’s element type
17
type Item;
18
+ /// The smallest type that can index and tell the length of the array.
19
#[doc(hidden)]
- /// The smallest index type that indexes the array.
20
type Index: Index;
21
+ /// The array's element capacity
22
+ const CAPACITY: usize;
23
24
fn as_ptr(&self) -> *const Self::Item;
25
@@ -91,6 +93,7 @@ macro_rules! fix_array_impl {
91
93
unsafe impl<T> Array for [T; $len] {
92
94
type Item = T;
95
type Index = $index_type;
96
+ const CAPACITY: usize = $len;
97
98
#[inline(always)]
99
fn as_ptr(&self) -> *const T { self as *const _ as *const _ }
0 commit comments