Print functionv0.1.0

Source
Writes a value's text to standard output.
pub func Print(value: String) -> IoError?
pub func Print(value: StringView) -> IoError?
pub func Print(value: char8[..]) -> IoError?
pub func Print(#Format() format: char8[..], ...) -> IoError?
pub func Print(value: bool8) -> IoError?
pub func Print(value: bool16) -> IoError?
pub func Print(value: bool32) -> IoError?
pub func Print(value: bool64) -> IoError?
pub func Print(value: bool128) -> IoError?
pub func Print(value: bool256) -> IoError?
pub func Print(value: bool512) -> IoError?
pub func Print(value: char8) -> IoError?
pub func Print(value: char16) -> IoError?
pub func Print(value: char32) -> IoError?
pub func Print(value: char64) -> IoError?
pub func Print(value: char128) -> IoError?
pub func Print(value: char256) -> IoError?
pub func Print(value: char512) -> IoError?
pub func Print(value: int8) -> IoError?
pub func Print(value: int16) -> IoError?
pub func Print(value: int32) -> IoError?
pub func Print(value: int64) -> IoError?
pub func Print(value: uint8) -> IoError?
pub func Print(value: uint16) -> IoError?
pub func Print(value: uint32) -> IoError?
pub func Print(value: uint64) -> IoError?
pub func Print(value: int) -> IoError?
pub func Print(value: uint) -> IoError?
pub func Print(value: float8) -> IoError?
pub func Print(value: float16) -> IoError?
pub func Print(value: float32) -> IoError?
pub func Print(value: float64) -> IoError?

A String, a StringView or a char8[..] is written as the UTF-8 bytes it holds, unchanged: nothing is substituted and no brace is special, so Print("{{}}") writes {{}}. Each primitive overload writes its value as PrintValue does, through the type's Display conformance, and any other value goes through PrintValue itself. Given arguments after it, the first text is a pattern instead: each {} or {:spec} takes the next argument in order, and {{ and }} write a literal brace. Every overload returns the failure its write met as an IoError, or none. A program logging to a terminal loses nothing by ignoring it; one whose output feeds a pipe that may close has something to look at.

OverloadSummary
pub func Print(value: String) -> IoError?Writes a value's text to standard output.
pub func Print(value: StringView) -> IoError?Writes the text a StringView borrows to standard output.
pub func Print(value: char8[..]) -> IoError?Writes text to standard output.
pub func Print(#Format() format: char8[..], ...) -> IoError?Writes format to standard output with each {} replaced by the next argument.
pub func Print(value: bool8) -> IoError?Writes a bool8 to standard output.
pub func Print(value: bool16) -> IoError?Writes a bool16 to standard output.
pub func Print(value: bool32) -> IoError?Writes a bool32 to standard output.
pub func Print(value: bool64) -> IoError?Writes a bool64 to standard output.
pub func Print(value: bool128) -> IoError?Writes a bool128 to standard output.
pub func Print(value: bool256) -> IoError?Writes a bool256 to standard output.
pub func Print(value: bool512) -> IoError?Writes a bool512 to standard output.
pub func Print(value: char8) -> IoError?Writes a char8 to standard output.
pub func Print(value: char16) -> IoError?Writes a char16 to standard output.
pub func Print(value: char32) -> IoError?Writes a char32 to standard output.
pub func Print(value: char64) -> IoError?Writes a char64 to standard output.
pub func Print(value: char128) -> IoError?Writes a char128 to standard output.
pub func Print(value: char256) -> IoError?Writes a char256 to standard output.
pub func Print(value: char512) -> IoError?Writes a char512 to standard output.
pub func Print(value: int8) -> IoError?Writes a int8 to standard output.
pub func Print(value: int16) -> IoError?Writes a int16 to standard output.
pub func Print(value: int32) -> IoError?Writes a int32 to standard output.
pub func Print(value: int64) -> IoError?Writes a int64 to standard output.
pub func Print(value: uint8) -> IoError?Writes a uint8 to standard output.
pub func Print(value: uint16) -> IoError?Writes a uint16 to standard output.
pub func Print(value: uint32) -> IoError?Writes a uint32 to standard output.
pub func Print(value: uint64) -> IoError?Writes a uint64 to standard output.
pub func Print(value: int) -> IoError?Writes a int to standard output.
pub func Print(value: uint) -> IoError?Writes a uint to standard output.
pub func Print(value: float8) -> IoError?Writes a float8 to standard output.
pub func Print(value: float16) -> IoError?Writes a float16 to standard output.
pub func Print(value: float32) -> IoError?Writes a float32 to standard output.
pub func Print(value: float64) -> IoError?Writes a float64 to standard output.

Parameters

NameTypeDescription
valueStringthe value to write
valueStringViewthe value to write
valuechar8[..]the value to write
#Format() formatchar8[..]
...
valuebool8the value to write
valuebool16the value to write
valuebool32the value to write
valuebool64the value to write
valuebool128the value to write
valuebool256the value to write
valuebool512the value to write
valuechar8the value to write
valuechar16the value to write
valuechar32the value to write
valuechar64the value to write
valuechar128the value to write
valuechar256the value to write
valuechar512the value to write
valueint8the value to write
valueint16the value to write
valueint32the value to write
valueint64the value to write
valueuint8the value to write
valueuint16the value to write
valueuint32the value to write
valueuint64the value to write
valueintthe value to write
valueuintthe value to write
valuefloat8the value to write
valuefloat16the value to write
valuefloat32the value to write
valuefloat64the value to write

Returns: the failure, or none when the whole value was written

pub func PrintValue(value: Display) -> IoError?

Writes a value's text to standard output. Nothing is allocated: the value writes itself straight to the stream. The value arrives as an interface value, which copies it — or takes it, for a type that prohibits copying. WriteValueLine is the borrowing form, and takes any destination, so a value that must not be given up goes through a ConsoleWriter and that instead. A stream failure is returned as the stream reported it. A formatting failure on a healthy stream is translated by ToIoError, so a request that was wrong arrives as InvalidInput and stays distinguishable from anything the destination did. Which formatting failure it was does not survive that translation, since IoError has no room for one; a caller who needs it builds a ConsoleWriter and calls Text::WriteValue themselves.

Source

Parameters

NameTypeDescription
valueDisplaythe value to write

Returns: what the stream reported, or the translated formatting failure on a healthy stream, or none