@@ -26,10 +26,11 @@ use crate::arrayvec_impl::ArrayVecImpl;
26
26
/// A vector with a fixed capacity.
27
27
///
28
28
/// The `ArrayVec` is a vector backed by a fixed size array. It keeps track of
29
- /// the number of initialized elements.
29
+ /// the number of initialized elements. The `ArrayVec<T, CAP>` is parameterized
30
+ /// by `T` for the element type and `CAP` for the maximum capacity.
30
31
///
31
- /// The vector is a contiguous value that you can store directly on the stack
32
- /// if needed.
32
+ /// The vector is a contiguous value (storing the elements inline) that you can store directly on
33
+ /// the stack if needed.
33
34
///
34
35
/// It offers a simple API but also dereferences to a slice, so
35
36
/// that the full slice API is available.
@@ -62,7 +63,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
62
63
63
64
/// Create a new empty `ArrayVec`.
64
65
///
65
- /// Capacity is inferred from the type parameter.
66
+ /// The maximum capacity is given by the generic parameter `CAP` .
66
67
///
67
68
/// ```
68
69
/// use arrayvec::ArrayVec;
@@ -122,7 +123,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
122
123
#[ inline( always) ]
123
124
pub fn capacity ( & self ) -> usize { CAP }
124
125
125
- /// Return if the `ArrayVec` is completely filled.
126
+ /// Return ture if the `ArrayVec` is completely filled to its capacity, false otherwise .
126
127
///
127
128
/// ```
128
129
/// use arrayvec::ArrayVec;
@@ -478,7 +479,7 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
478
479
self . len = length;
479
480
}
480
481
481
- /// Copy and appends all elements in a slice to the `ArrayVec`.
482
+ /// Copy all elements from the slice and append to the `ArrayVec`.
482
483
///
483
484
/// ```
484
485
/// use arrayvec::ArrayVec;
@@ -527,10 +528,10 @@ impl<T, const CAP: usize> ArrayVec<T, CAP> {
527
528
/// ```
528
529
/// use arrayvec::ArrayVec;
529
530
///
530
- /// let mut v = ArrayVec::from([1, 2, 3]);
531
- /// let u : ArrayVec<_, 3> = v .drain(0..2).collect();
532
- /// assert_eq!(&v [..], &[3]);
533
- /// assert_eq!(&u [..], &[1, 2]);
531
+ /// let mut v1 = ArrayVec::from([1, 2, 3]);
532
+ /// let v2 : ArrayVec<_, 3> = v1 .drain(0..2).collect();
533
+ /// assert_eq!(&v1 [..], &[3]);
534
+ /// assert_eq!(&v2 [..], &[1, 2]);
534
535
/// ```
535
536
pub fn drain < R > ( & mut self , range : R ) -> Drain < T , CAP >
536
537
where R : RangeBounds < usize >
0 commit comments