docs

core::print

API 參考只有英文版,由標準函式庫原始碼中的英文文件註解產生。

print / println / eprint / eprintln, dbg and display (the prelude names them, so they need no use).

A direct call takes any number of values, written with Display (with Debug for a type that has no Display), joined by sep: (default " ") and followed by end: (default "\n" for the ln forms, else nothing): println("total:", n, xs). The functions below are what a call through a function value (xs.for_each(println)) runs: one Display value. A direct dbg(e) also shows e's source text.

They share the runtime's stream writers with io::stdout() / io::stderr(); one call writes its line whole, so lines from different threads never interleave. Write errors are dropped.

Functions

printSource

pub fn print<T: Display>(v: T = "")

Writes v to stdout.

printlnSource

pub fn println<T: Display>(v: T = "")

Writes v and a newline to stdout.

eprintSource

pub fn eprint<T: Display>(v: T = "")

Writes v to stderr.

eprintlnSource

pub fn eprintln<T: Display>(v: T = "")

Writes v and a newline to stderr.

displaySource

pub fn display<T: RichDisplay>(x: T)

Shows x by its RichDisplay renderings now: in a nabi jupyter notebook as the cell's output at this point (display_data), elsewhere as its text/plain line (nothing without one).

dbgSource

pub fn dbg<T: Debug>(value: T) -> T

Writes value's Debug form to stderr and returns value (Rust dbg!). A direct call writes [file:line:col] <source> = <value>.