module core.rt.format

Code Map

module core.rt.format;


//! The argument that is passed to Sinks.
alias SinkArg = scope (const(scope (char)[]);
//! The Sink delegate.
alias Sink = scope (void delegate(scope (SinkArg)));
//! These are the sink store that the compiler uses for composable
//! strings.
alias SinkStore = SinkStore1024;
//! These are the sink store that the compiler uses for composable
//! strings.
alias vrt_sink_init = vrt_sink_init_1024;
//! Default implementation of SinkStore used by the compiler.
alias SinkStore1024 = void[1024];

//! Format a given u64 as a string, and pass it to sink.
fn vrt_format_u64(sink: scope (Sink), i: u64);
//! Format a given i64 as a string, and pass it to sink.
fn vrt_format_i64(sink: scope (Sink), i: i64);
//! Format a given f32 as a string, and pass it to sink.
fn vrt_format_f32(sink: scope (Sink), i: f32, width: i32);
//! Format a given f64 as a string, and pass it to sink.
fn vrt_format_f64(sink: scope (Sink), i: f64, width: i32);
//! Format a given integer as a hex string, and pass it to sink.
fn vrt_format_hex(sink: scope (Sink), i: u64, padding: size_t);
//! Format a given u64 and pass it to sink.
fn vrt_format_readable_size(sink: scope (Sink), size: u64);
//! Format a given dchar as a string (surrounded with ') and pass it to 
//! sink.
fn vrt_format_dchar(sink: scope (Sink), c: dchar);
//! Default implementation of SinkStore used by the compiler.
fn vrt_sink_init_1024(sink: SinkStore1024) scope (Sink);
//! Default implementation of SinkStore used by the compiler.
fn vrt_sink_getstr_1024(sink: SinkStore1024) string;
alias SinkArg

The argument that is passed to Sinks.

alias Sink

The Sink delegate.

A Sink is a delegate that takes a SinkArg, and builds a string, usually with an aim to minimise needless allocations and GC calls.

fn vrt_format_u64(sink: scope (Sink), i: u64)

Format a given u64 as a string, and pass it to sink.

fn vrt_format_i64(sink: scope (Sink), i: i64)

Format a given i64 as a string, and pass it to sink.

fn vrt_format_f32(sink: scope (Sink), i: f32, width: i32)

Format a given f32 as a string, and pass it to sink.

The width determines the rounding point. -1 leaves it as the implementation default.

fn vrt_format_f64(sink: scope (Sink), i: f64, width: i32)

Format a given f64 as a string, and pass it to sink.

The width determines the rounding point. -1 leaves it as the implementation default.

fn vrt_format_hex(sink: scope (Sink), i: u64, padding: size_t)

Format a given integer as a hex string, and pass it to sink.

The hex letters will be uppercase, it will not be preceded with 0x, and padding specifies the minimum length of the string -- if the result is less, it will be filled in with 0 characters.

fn vrt_format_readable_size(sink: scope (Sink), size: u64)

Format a given u64 and pass it to sink.

fn vrt_format_dchar(sink: scope (Sink), c: dchar)

Format a given dchar as a string (surrounded with ') and pass it to sink.

alias SinkStore

These are the sink store that the compiler uses for composable strings.

The returned delegate is only valid as long as the storage of the SinkStore is valid.

alias vrt_sink_init

These are the sink store that the compiler uses for composable strings.

The returned delegate is only valid as long as the storage of the SinkStore is valid.

alias SinkStore1024

Default implementation of SinkStore used by the compiler.

fn vrt_sink_init_1024(sink: SinkStore1024) scope (Sink)

Default implementation of SinkStore used by the compiler.

fn vrt_sink_getstr_1024(sink: SinkStore1024) string

Default implementation of SinkStore used by the compiler.