Lines Matching refs:cap
55 cap: usize, field
124 Self { ptr: Unique::dangling(), cap: 0, alloc } in new_in()
206 cap: capacity, in allocate_in()
231 cap: capacity, in try_allocate_in()
248 Self { ptr: unsafe { Unique::new_unchecked(ptr) }, cap: capacity, alloc } in from_raw_parts_in()
264 if T::IS_ZST { usize::MAX } else { self.cap } in capacity()
273 if T::IS_ZST || self.cap == 0 { in current_memory()
283 let size = mem::size_of::<T>().unchecked_mul(self.cap); in current_memory()
395 pub fn shrink_to_fit(&mut self, cap: usize) { in shrink_to_fit()
396 handle_reserve(self.shrink(cap)); in shrink_to_fit()
407 fn set_ptr_and_cap(&mut self, ptr: NonNull<[u8]>, cap: usize) { in set_ptr_and_cap()
412 self.cap = cap; in set_ptr_and_cap()
437 let cap = cmp::max(self.cap * 2, required_cap); in grow_amortized() localVariable
438 let cap = cmp::max(Self::MIN_NON_ZERO_CAP, cap); in grow_amortized() localVariable
440 let new_layout = Layout::array::<T>(cap); in grow_amortized()
444 self.set_ptr_and_cap(ptr, cap); in grow_amortized()
458 let cap = len.checked_add(additional).ok_or(CapacityOverflow)?; in grow_exact() localVariable
459 let new_layout = Layout::array::<T>(cap); in grow_exact()
463 self.set_ptr_and_cap(ptr, cap); in grow_exact()
468 fn shrink(&mut self, cap: usize) -> Result<(), TryReserveError> { in shrink()
469 assert!(cap <= self.capacity(), "Tried to shrink to a larger capacity"); in shrink()
477 let new_size = mem::size_of::<T>().unchecked_mul(cap); in shrink()
483 self.set_ptr_and_cap(ptr, cap); in shrink()