Skip to main content

Mojo trait

Stringlike

Trait intended to be used only with String, StringLiteral and StringSlice.

Implemented traits

AnyType

Methods

byte_length

byte_length(self: _Self) -> Int

Get the string length in bytes.

Notes: This does not include the trailing null terminator in the count.

Returns:

The length of this string in bytes.

unsafe_ptr

unsafe_ptr(self: _Self) -> UnsafePointer[SIMD[uint8, 1]]

Get raw pointer to the underlying data.

Returns:

The raw pointer to the data.