We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Vec::set_len
1 parent ad264f7 commit 1e0043eCopy full SHA for 1e0043e
src/libcollections/vec.rs
@@ -593,11 +593,12 @@ impl<T> Vec<T> {
593
/// ```
594
///
595
/// In this example, there is a memory leak since the memory locations
596
- /// owned by the vector were not freed prior to the `set_len` call:
+ /// owned by the inner vectors were not freed prior to the `set_len` call:
597
598
599
- /// let mut vec = vec!['r', 'u', 's', 't'];
600
- ///
+ /// let mut vec = vec![vec![1, 0, 0],
+ /// vec![0, 1, 0],
601
+ /// vec![0, 0, 1]];
602
/// unsafe {
603
/// vec.set_len(0);
604
/// }
0 commit comments