Skip to main content

Mojo trait

AsBytes

The AsBytes trait denotes a type that can be returned as a immutable byte span.

Implemented traits

AnyType

Methods

as_bytes

as_bytes(ref self: _Self) -> Span[SIMD[uint8, 1], $1]

Returns a contiguous slice of the bytes owned by this string.

Notes: This does not include the trailing null terminator.

Returns:

A contiguous slice pointing to the bytes owned by this string.