Lines Matching full:layout
15 use crate::alloc::{Allocator, Global, Layout};
178 let layout = match Layout::array::<T>(capacity) { in allocate_in() localVariable
179 Ok(layout) => layout, in allocate_in()
182 match alloc_guard(layout.size()) { in allocate_in()
187 AllocInit::Uninitialized => alloc.allocate(layout), in allocate_in()
188 AllocInit::Zeroed => alloc.allocate_zeroed(layout), in allocate_in()
192 Err(_) => handle_alloc_error(layout), in allocate_in()
242 fn current_memory(&self) -> Option<(NonNull<u8>, Layout)> { in current_memory() argument
247 // checks to get our current layout. in current_memory()
249 let layout = Layout::array::<T>(self.cap).unwrap_unchecked(); in current_memory() localVariable
250 Some((self.ptr.cast().into(), layout)) in current_memory()
405 let new_layout = Layout::array::<T>(cap); in grow_amortized()
424 let new_layout = Layout::array::<T>(cap); in grow_exact()
436 let (ptr, layout) = if let Some(mem) = self.current_memory() { mem } else { return Ok(()) }; in shrink()
439 // `Layout::array` cannot overflow here because it would have in shrink()
441 let new_layout = Layout::array::<T>(cap).unwrap_unchecked(); in shrink()
443 .shrink(ptr, layout, new_layout) in shrink()
444 .map_err(|_| AllocError { layout: new_layout, non_exhaustive: () })? in shrink()
457 new_layout: Result<Layout, LayoutError>, in finish_grow() argument
458 current_memory: Option<(NonNull<u8>, Layout)>, in finish_grow() argument
480 memory.map_err(|_| AllocError { layout: new_layout, non_exhaustive: () }.into()) in finish_grow()
486 if let Some((ptr, layout)) = self.current_memory() { in drop()
487 unsafe { self.alloc.deallocate(ptr, layout) } in drop()
498 Err(AllocError { layout, .. }) => handle_alloc_error(layout), in handle_reserve()