PrintLine functionv0.1.0

Source
Writes a value's text to standard output, then a newline.
pub func PrintLine() -> IoError?

pub func PrintLine(value: String) -> IoError?

pub func PrintLine(value: char8[..]) -> IoError?

pub func PrintLine(value: StringView) -> IoError?

pub func PrintLine(
    #Format() format: char8[..],
    ...
) -> IoError?

pub func PrintLine(value: bool8) -> IoError?

pub func PrintLine(value: bool16) -> IoError?

pub func PrintLine(value: bool32) -> IoError?

pub func PrintLine(value: bool64) -> IoError?

pub func PrintLine(value: bool128) -> IoError?

pub func PrintLine(value: bool256) -> IoError?

pub func PrintLine(value: bool512) -> IoError?

pub func PrintLine(value: char8) -> IoError?

pub func PrintLine(value: char16) -> IoError?

pub func PrintLine(value: char32) -> IoError?

pub func PrintLine(value: char64) -> IoError?

pub func PrintLine(value: char128) -> IoError?

pub func PrintLine(value: char256) -> IoError?

pub func PrintLine(value: char512) -> IoError?

pub func PrintLine(value: int8) -> IoError?

pub func PrintLine(value: int16) -> IoError?

pub func PrintLine(value: int32) -> IoError?

pub func PrintLine(value: int64) -> IoError?

pub func PrintLine(value: uint8) -> IoError?

pub func PrintLine(value: uint16) -> IoError?

pub func PrintLine(value: uint32) -> IoError?

pub func PrintLine(value: uint64) -> IoError?

pub func PrintLine(value: int) -> IoError?

pub func PrintLine(value: uint) -> IoError?

pub func PrintLine(value: float8) -> IoError?

pub func PrintLine(value: float16) -> IoError?

pub func PrintLine(value: float32) -> IoError?

pub func PrintLine(value: float64) -> IoError?

Each overload writes exactly what the matching Print overload writes, then \n, and writes the newline only when the value's own write succeeded: a line is the value and its terminator together, so a failed write leaves no empty line behind and returns its own failure. PrintLine() writes the newline alone. Text with no arguments after it is written verbatim, braces and all. Given arguments, it is a pattern whose {} and {:spec} placeholders take them in order, and {{ and }} write a literal brace.

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

Parameters

NameTypeDescription
valueStringthe value to write
valuechar8[..]the value to write
valueStringViewthe 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 PrintValueLine(value: Display) -> IoError?

Writes a value's text to standard output, then a newline.

Source

Parameters

NameTypeDescription
valueDisplaythe value to write

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

WriteValueLine<T>

pub func WriteValueLine<T: Display>(
    writer: &var TextWriter,
    value: &T
) -> ! FormatError

Writes a value's text, then a newline, and writes the newline only if the value went out whole. The rule is the whole point. A line is a value and its terminator together, so a value that could not be written must not be followed by a terminator: a destination that refused halfway would otherwise get a line break marking the end of something that is not there, and a caller reading the output back would see a blank line where a value should be. This is what every PrintLine overload does over standard output, written once for any destination. The value is taken by bound rather than as an interface value, and that is the difference between writing a value and taking it: binding a move-only value to a Display transfers ownership of it, so a surface that accepted one could write such a value exactly once and the caller would not have it afterwards. Here it is borrowed, so it may be written as often as wanted and is still the caller's. Reports the value's own failure when it has one, without attempting the newline. Otherwise reports whatever the newline's write reported.

Source

Type parameters

NameDescription
T: Displaythe value's type, which must know how to show itself

Parameters

NameTypeDescription
writer&var TextWriterthe destination
value&Tthe value to write, borrowed for the call

Returns: success when both the value and the newline were accepted

WriteFormatLine

pub func WriteFormatLine(
    writer: &var TextWriter,
    #Format() format: char8[..],
    ...
) -> ! FormatError

Writes format with each {} replaced by the next argument, then a newline, on the same rule. The newline goes out only if the whole pattern did, so a pattern that does not parse, an argument count that does not match and a destination that refused all leave no terminator behind. Nothing is allocated: the arguments write themselves as they are reached. They arrive as interface values, which is what a variadic can carry, so a move-only argument goes through WriteValueLine instead of through a placeholder. A literal format has its placeholders counted against the arguments while compiling, since it is marked #Format(). Reports the formatting failure when there is one, without attempting the newline. Otherwise reports whatever the newline's write reported.

Source

Parameters

NameTypeDescription
writer&var TextWriterthe destination
#Format() formatchar8[..]
...

Returns: success when the whole line was accepted