fmt/core

sourcefmt/core.sx

ParseIntError

pub enum ParseIntError = { Empty, InvalidDigit, Overflow }

Variants

  • Empty
  • InvalidDigit
  • Overflow

ParseFloatError

pub enum ParseFloatError = { Empty, Invalid, Overflow }

Variants

  • Empty
  • Invalid
  • Overflow

rewrite_fmt

private
fn rewrite_fmt(fmt: ref u8) ref void = trust { ... }

Runtime rewrite of Spectre format specifiers to printf specifiers.

alloc_in

private
fn alloc_in[A: allocators.Allocator](ac: A, len: i64) ref void

alloc_cstr

private
fn alloc_cstr[A: allocators.Allocator](ac: A, len: i64) ref u8

alloc_string

private
fn alloc_string[A: allocators.Allocator](ac: A, len: i64) String

copy_cstr

private
fn copy_cstr[A: allocators.Allocator](ac: A, src: ref u8) ref u8

i64_to_string_heap

private
fn i64_to_string_heap(x: i64) ref u8 = trust { ... }

format

pub fn format[A: allocators.Allocator](ac: A, fmt: ref u8, args: untyped) String

i64_to_string

pub fn i64_to_string[A: allocators.Allocator](ac: A, x: i64) ref u8

strlen

private
extern (C) fn strlen(s: ref u8) i64 = trust { ... } = "strlen"

string_to_i64

pub fn string_to_i64(s: ref u8) result[i64, ParseIntError]

f64_to_string

pub fn f64_to_string[A: allocators.Allocator](ac: A, x: f64) ref u8

string_to_f64

pub fn string_to_f64(s: ref u8) result[f64, ParseFloatError]

test_i64_roundtrip

private
fn test_i64_roundtrip(x: i64) void = trust { ... }

test_f64_roundtrip

private
fn test_f64_roundtrip(x: f64) void = trust { ... }