Skip to main content
Log in

Mojo trait

AsBytes

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

Implemented traits

AnyType, UnknownDestructibility

Methods

as_bytes

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

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.