For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).
Alignment
struct Alignment
The byte alignment of a memory allocation.
Implemented traits
AnyType,
Copyable,
Deinitable,
ImplicitlyCopyable,
Movable,
RegisterPassable,
TrivialRegisterPassable,
Writable
Methods
of
static def of[T: AnyType, /]() -> Self
Returns the natural alignment of T.
Parameters:
- T (
AnyType): The type whosealign_ofto use.
Returns:
Self: An Alignment of align_of[T]() bytes.
of_bytes
static def of_bytes[n: Int, /]() -> Self
Returns an alignment of exactly n bytes.
Constraints:
n must be a power of two.
Parameters:
- n (
Int): The byte alignment.
Returns:
Self: An Alignment of n bytes.
bytes
write_to
def write_to(self, mut writer: T)
Writes a human-readable representation of this alignment to writer.
Args:
- writer (
T): The writer to write to.