Lines Matching defs:layout
27 /// `layout`.
28 pub fn aligned_layout(layout: Layout) -> Layout {
29 // Note that `layout.size()` (after padding) is guaranteed to be a multiple of
30 // `layout.align()` which together with the slab guarantees means that `Kmalloc` will return
32 layout.pad_to_align()
51 layout: Layout,
66 if layout.size() == 0 {
71 crate::alloc::dangling_from_layout(layout),
91 let layout = layout.align_to(min_align).map_err(|_| AllocError)?;
92 let layout = layout.pad_to_align();
96 let dst = unsafe { libc_aligned_alloc(layout.align(), layout.size()) }.cast::<u8>();
101 // guarantee that `dst` points to memory of at least `layout.size()` bytes.
102 unsafe { dst.as_ptr().write_bytes(0, layout.size()) };
114 cmp::min(layout.size(), old_layout.size()),
122 Ok(NonNull::slice_from_raw_parts(dst, layout.size()))