Lines Matching refs:layout
8 pub mod layout;
169 /// the requested layout has a smaller alignment.
172 /// Allocate memory based on `layout`, `flags` and `nid`.
174 /// On success, returns a buffer represented as `NonNull<[u8]>` that satisfies the layout
175 /// constraints (i.e. minimum size and alignment as specified by `layout`).
182 /// - valid for reads and writes for `layout.size()` bytes, until it is passed to
184 /// - aligned to `layout.align()`,
188 fn alloc(layout: Layout, flags: Flags, nid: NumaNode) -> Result<NonNull<[u8]>, AllocError> {
191 unsafe { Self::realloc(None, layout, Layout::new::<()>(), flags, nid) }
194 /// Re-allocate an existing memory allocation to satisfy the requested `layout` and
231 /// and old size, i.e. `ret_ptr[0..min(layout.size(), old_layout.size())] ==
232 /// p[0..min(layout.size(), old_layout.size())]`.
236 layout: Layout,
249 /// - `layout` must match the `Layout` the allocation has been created with.
251 unsafe fn free(ptr: NonNull<u8>, layout: Layout) {
259 layout,
267 /// Returns a properly aligned dangling pointer from the given `layout`.
268 pub(crate) fn dangling_from_layout(layout: Layout) -> NonNull<u8> {
269 let ptr = layout.align() as *mut u8;
271 // SAFETY: `layout.align()` (and hence `ptr`) is guaranteed to be non-zero.