We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c84972d commit 70842fcCopy full SHA for 70842fc
src/next_array.rs
@@ -3,8 +3,15 @@ use core::ptr;
3
4
/// An array of at most `N` elements.
5
struct ArrayBuilder<T, const N: usize> {
6
- arr: [MaybeUninit<T>; N], // Invariant: arr[..len] is valid.
7
- len: usize, // Invariant: len <= N.
+ /// The (possibly uninitialized) elements of the `ArrayBuilder`.
+ ///
8
+ /// # Safety
9
10
+ /// The elements of `arr[..len]` are valid `T`s.
11
+ arr: [MaybeUninit<T>; N],
12
+
13
+ /// The number of leading elements of `arr` that are valid `T`s, len <= N.
14
+ len: usize,
15
}
16
17
impl<T, const N: usize> ArrayBuilder<T, N> {
0 commit comments