Skip to content

Commit ac583f1

Browse files
committedDec 5, 2022
Add O(1) Vec -> VecDeque conversion guarantee
1 parent 203c876 commit ac583f1

File tree

1 file changed

+3
-3
lines changed
  • library/alloc/src/collections/vec_deque

1 file changed

+3
-3
lines changed
 

‎library/alloc/src/collections/vec_deque/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -2794,9 +2794,9 @@ impl<T, A: Allocator> From<Vec<T, A>> for VecDeque<T, A> {
27942794
/// [`Vec<T>`]: crate::vec::Vec
27952795
/// [`VecDeque<T>`]: crate::collections::VecDeque
27962796
///
2797-
/// In its current implementation, this is a very cheap
2798-
/// conversion. This isn't yet a guarantee though, and
2799-
/// shouldn't be relied on.
2797+
/// This conversion is guaranteed to run in *O*(1) time
2798+
/// and to not re-allocate the `Vec`'s buffer or allocate
2799+
/// any additional memory.
28002800
#[inline]
28012801
fn from(other: Vec<T, A>) -> Self {
28022802
let (ptr, len, cap, alloc) = other.into_raw_parts_with_alloc();

0 commit comments

Comments
 (0)