API reference Dodo 0.1.4

alloc/layout

Public declarations, types, methods, and source contracts for alloc/layout.

On this page

Library guide · API index and notation

This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.

import "alloc/layout"

Names used in signatures

Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.

Alias Package Source file
error alloc/error layout.dodo
mem core/mem layout.dodo

max_size

Function · Source

Keep object sizes within the signed pointer-offset range on every target.

pub fn max_size() -> usize

Layout

Struct · Source

A Layout has nonzero power-of-two alignment. Its size rounded up to that alignment fits in isize. Fields are private to preserve those invariants.

pub struct Layout {
    // Private implementation fields omitted.
}

Layout.new

Function · Source

pub fn new(size: usize, align: usize) -> Layout!error.AllocError

Layout.size

Function · Source

pub fn size(&self) -> usize

Layout.align

Function · Source

pub fn align(&self) -> usize

Layout.clone

Function · Source

pub fn clone(&self) -> Layout

Layout.padding

Function · Source

pub fn padding(&self) -> usize

Layout.pad_to_align

Function · Source

pub fn pad_to_align(&self) -> Layout

Layout.align_to

Function · Source

Increase alignment without changing size; never reduce existing alignment.

pub fn align_to(&self, align: usize) -> Layout!error.AllocError

Layout.repeat

Function · Source

Lay out adjacent array elements with the padding each element requires.

pub fn repeat(&self, count: usize) -> Layout!error.AllocError

Layout.extend

Function · Source

Append a field with its required alignment. The result is deliberately not padded at the end: use pad_to_align before making an array of it.

pub fn extend(&self, next: &Layout) -> ExtendedLayout!error.AllocError

ExtendedLayout

Struct · Source

pub struct ExtendedLayout {
    // Private implementation fields omitted.
}

ExtendedLayout.offset

Function · Source

pub fn offset(&self) -> usize

ExtendedLayout.layout

Function · Source

pub fn layout(&self) -> &Layout

ExtendedLayout.into_layout

Function · Source

pub fn into_layout(self) -> Layout

of

Function · Source

pub fn of<T>() -> Layout!error.AllocError

array

Function · Source

pub fn array<T>(count: usize) -> Layout!error.AllocError

Type to search all documentation.

Keyboard shortcuts

Search documentation
Ctrl K or /
Move through results
↑ ↓
Open selected result
Enter
Close a dialog
Esc
Show these shortcuts
?