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
fn String(b: *byte, n: int): stringReturns 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
fn Slice[Elem](mut e: *Elem, len: int, cap: int): []ElemReturns slice based on e, the parameter e means first element of slice. Will not perform garbage collection.
Bytes
fn Bytes(mut b: *byte, n: int): []byteAlias for Slice(b, n, n).
StringBytes
fn StringBytes(s: string): []byteAlias for Slice(&s[0], len(s), len(s)). Returns nil if len(s) == 0.
BytesString
fn BytesString(b: []byte): stringAlias for String(&b[0], len(b), len(b)). Returns empty string if len(b) == 0.
StringFromBytes
fn StringFromBytes(b: []byte): stringSame as [BytesString] but keeps garbage collection.
BytesFromString
fn BytesFromString(s: string): []byteSame as [StringBytes] but keeps garbage collection.