Expand description
I/O Operations for LOGOS Programs
Provides input/output primitives for LOGOS programs including:
show: Natural formatting output (primitives without quotes, collections with brackets)print,println,eprintln: Standard output functionsread_line: Read a line from stdin
The Showable trait enables custom types to integrate with the show verb.
§Example
use logicaffeine_system::io::{show, println, read_line};
// Natural formatting with show
show(&42); // Prints: 42
show(&"hello"); // Prints: hello (no quotes)
show(&vec![1, 2, 3]); // Prints: [1, 2, 3]
// Standard output
println("Enter your name:");
let name = read_line();
println(format!("Hello, {}!", name));Traits§
- Showable
- Custom trait for LOGOS Show verb - provides clean, natural output. Primitives display without quotes, collections display with brackets.
Functions§
- eprintln
- flush_
stdout - Write everything shown so far. Called wherever stdout’s order against something else becomes observable: before stderr, before input is read, before a program’s own Rust writes to stdout, and when a program fails.
- format_
currency - A currency hole (
{x:$}), rendered exactly as the interpreter’sapply_format_spec: an integer or a float as money with two decimals, an exact integer beyondi64with an exact.00, and every other value — an exact decimal keeps its own digits — as$before its own display. - format_
fixed - A fixed-precision hole (
{x:.2}), rendered exactly as the interpreter’sapply_format_spec: an integer or a float toprecisionplaces, and every other value as its own display. - println
- read_
line - show
- The Show verb - prints value with natural formatting Takes a reference to avoid moving the value.
- show_
string - Render any
Showablevalue to aStringusing the SAME natural formatting asshow— used by string interpolation holes so"{s}"matchesShow sbyte-for-byte, even for types (Sets, user structs) that implementShowablebut notstd::fmt::Display.