Rollup merge of #72921 - pickfire:vec-assert, r=Mark-Simulacrum
Add assert to Vec with_capacity docs
This commit is contained in:
commit
ba3d98250f
1 changed files with 2 additions and 0 deletions
|
@ -348,9 +348,11 @@ impl<T> Vec<T> {
|
||||||
/// for i in 0..10 {
|
/// for i in 0..10 {
|
||||||
/// vec.push(i);
|
/// vec.push(i);
|
||||||
/// }
|
/// }
|
||||||
|
/// assert_eq!(vec.capacity(), 10);
|
||||||
///
|
///
|
||||||
/// // ...but this may make the vector reallocate
|
/// // ...but this may make the vector reallocate
|
||||||
/// vec.push(11);
|
/// vec.push(11);
|
||||||
|
/// assert!(vec.capacity() >= 11);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue