Skip to content

std/unsafe

DANGER

This package is under the terms of the Unsafe Jule. Be careful using API of this package. Doing things correct is developer's responsibility.

Index

fn String(b: *byte, n: int): string
fn Slice[Elem](mut e: *Elem, len: int, cap: int): []Elem
fn Bytes(mut b: *byte, n: int): []byte
fn StringBytes(s: string): []byte
fn BytesString(b: []byte): string
fn StringFromBytes(b: []byte): string
fn BytesFromString(s: string): []byte

String

jule
fn String(b: *byte, n: int): string

Returns string based on b, the parameter b means first byte of string. The returned string uses n as length. Will not perform garbage collection.

Slice

jule
fn Slice[Elem](mut e: *Elem, len: int, cap: int): []Elem

Returns slice based on e, the parameter e means first element of slice. Will not perform garbage collection.

Bytes

jule
fn Bytes(mut b: *byte, n: int): []byte

Alias for Slice(b, n, n).

StringBytes

jule
fn StringBytes(s: string): []byte

Alias for Slice(&s[0], len(s), len(s)). Returns nil if len(s) == 0.

BytesString

jule
fn BytesString(b: []byte): string

Alias for String(&b[0], len(b), len(b)). Returns empty string if len(b) == 0.

StringFromBytes

jule
fn StringFromBytes(b: []byte): string

Same as [BytesString] but keeps garbage collection.

BytesFromString

jule
fn BytesFromString(s: string): []byte

Same as [StringBytes] but keeps garbage collection.