Skip to content

FieldOffsets

Mojo struct 🡭

@memory_only
struct FieldOffsets[MAX: Int = 64]

Stack-allocated flat array of (start, end) byte pairs for up to MAX fields.

Layout: [start0, end0, start1, end1, …] — avoids a separate count field at the cost of doubling the index arithmetic, which is branch-free.

  • MAX (Int)

AnyType, Copyable, ImplicitlyDestructible, Movable, Sized

def __init__(out self)

Args:

  • self (Self)

Returns:

Self

def __len__(self) -> Int

Args:

  • self (Self)

Returns:

Int

def start(self, i: Int) -> Int

Args:

  • self (Self)
  • i (Int)

Returns:

Int

def end(self, i: Int) -> Int

Args:

  • self (Self)
  • i (Int)

Returns:

Int