Lines Matching full:vec
3 //! Extensions to [`Vec`] for fallible allocations.
6 use alloc::vec::Vec;
8 /// Extensions to [`Vec`].
10 /// Creates a new [`Vec`] instance with at least the given capacity.
15 /// let v = Vec::<u32>::with_capacity(20, GFP_KERNEL)?;
22 /// Appends an element to the back of the [`Vec`] instance.
27 /// let mut v = Vec::new();
37 /// Pushes clones of the elements of slice into the [`Vec`] instance.
42 /// let mut v = Vec::new();
61 /// let mut v = Vec::new();
77 impl<T> VecExt<T> for Vec<T> { implementation
79 let mut v = Vec::new(); in with_capacity()
114 Vec::reserve(self, additional); in reserve()
140 // `krealloc_aligned`. A `Vec<T>`'s `ptr` value is not guaranteed to be NULL and might be in reserve()
141 // dangling after being created with `Vec::new`. Instead, we can rely on `Vec<T>`'s capacity in reserve()
153 // SAFETY: We are just rebuilding the existing `Vec` with no changes. in reserve()
166 fn destructure<T>(v: &mut Vec<T>) -> (*mut T, usize, usize) { in destructure()
167 let mut tmp = Vec::new(); in destructure()
175 /// Rebuilds a `Vec` from a pointer, length, and capacity.
179 /// The same as [`Vec::from_raw_parts`].
181 unsafe fn rebuild<T>(v: &mut Vec<T>, ptr: *mut T, len: usize, cap: usize) { in rebuild()
183 let mut tmp = unsafe { Vec::from_raw_parts(ptr, len, cap) }; in rebuild()