Skip to content
volt
GitHub

std::fmt

Formatting into anything. write(&out, "a {} b {:>5}", x, y) appends to any value whose type attaches write_str(this: T&, s: str) -> void; format(...) returns the text as a new string. Format strings are checked at compile time, like println's; {:spec} works in all of them.

Source: std/fmt.volt

Functions

std::fmt::write

fn write() -> void

write(&out, "a {} b {}", x, y): the formatted text, handed to out's write_str

std::fmt::format

fn format() -> std::string

format("a {} b {}", x, y): the formatted text as a new string