Skip to content

Commit

Permalink
Add doc comments to ArrayBuilder members.
Browse files Browse the repository at this point in the history
  • Loading branch information
orlp committed Jun 5, 2024
1 parent c84972d commit 70842fc
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/next_array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@ use core::ptr;

/// An array of at most `N` elements.
struct ArrayBuilder<T, const N: usize> {
arr: [MaybeUninit<T>; N], // Invariant: arr[..len] is valid.
len: usize, // Invariant: len <= N.
/// The (possibly uninitialized) elements of the `ArrayBuilder`.
///
/// # Safety
///
/// The elements of `arr[..len]` are valid `T`s.
arr: [MaybeUninit<T>; N],

/// The number of leading elements of `arr` that are valid `T`s, len <= N.
len: usize,
}

impl<T, const N: usize> ArrayBuilder<T, N> {
Expand Down

0 comments on commit 70842fc

Please sign in to comment.