DelimitedRecord
Mojo struct 🡭
DelimitedRecord
Section titled “DelimitedRecord”@memory_onlystruct DelimitedRecord[MAX: Int = 64]An owned, heap-allocated delimited row.
Created either directly (when ownership is needed from the start) or via
DelimitedView.to_record(). Holds exactly one BString (the raw
line bytes) and a stack-allocated FieldOffsets.
Field access via get_span() is zero-copy into the owned BString.
Parameters
Section titled “Parameters”- MAX (
Int)
Implemented traits
Section titled “Implemented traits”AnyType, Copyable, ImplicitlyDestructible, Movable, Sized, Writable
Methods
Section titled “Methods”__init__
Section titled “__init__”def __init__(out self)Args:
- self (
Self)
Returns:
Self
def __init__(out self, var view: DelimitedView[view.O, MAX])Materialize from a view — one BString alloc, offsets copied by value.
Args:
- view (
DelimitedView) - self (
Self)
Returns:
Self
__getitem__
Section titled “__getitem__”def __getitem__(ref self, idx: Int) -> BStringOwned copy of field idx. Prefer get_span() in hot paths.
Args:
- self (
Self) - idx (
Int)
Returns:
BString
num_fields
Section titled “num_fields”def num_fields(self) -> IntArgs:
- self (
Self)
Returns:
Int
__len__
Section titled “__len__”def __len__(self) -> IntArgs:
- self (
Self)
Returns:
Int
get_span
Section titled “get_span”def get_span(ref self, idx: Int) -> Span[UInt8, origin_of(self._line)]Zero-copy view of field idx. Lifetime tied to this record.
Args:
- self (
Self) - idx (
Int)
Returns:
Span
def get(ref self, idx: Int) -> Optional[BString]Args:
- self (
Self) - idx (
Int)
Returns:
Optional
write_to
Section titled “write_to”def write_to[w: Writer](ref self, mut writer: w)Parameters:
- w (
Writer)
Args:
- self (
Self) - writer (
w)