Fmt

Module fmt

import fmt

The bridge between a value and its text.

fmt is how a value becomes text. sprint converts anything at all — it prefers the value’s prelude.Printable attribute and falls back to a plain rendering for built-in types — while fprint and fprintln send that text to a writer.

There is no print here on purpose: writing needs somewhere to write to. Pass a writer from os, or use scripts, a separate package pairing these functions with standard output for you.

Dependencies


Contents


Functions

fprint

`fmt/print.zirr:12`
fn fprint(value: @Printable, writer: @io.Writer) -> Int

Writes the string representation of a printable value to a writer.


fprintln

`fmt/print.zirr:18`
fn fprintln(value: @Printable, writer: @io.Writer) -> Int

Writes the string representation of a printable value followed by a newline to a writer.


sprint

`fmt/print.zirr:9`
extern fn sprint(value: Any) -> String

Converts any value to its string representation. Prefers the value’s
@Printable attribute when it has one, otherwise falls back to a trivial
conversion for builtin types (Int, Float, Char, Byte as hex, …).