Expand description
Printf-style formatting node.
Takes a format string and N inputs, produces a formatted String.
Uses {} placeholders (Rust-style, not C printf-style), with
optional format specifiers.
Supported specifiers:
{}— default display{:05}— zero-padded to width 5 (u64){:.2}— 2 decimal places (f64){:x}— lowercase hex (u64){:X}— uppercase hex (u64){:b}— binary (u64){:o}— octal (u64)
printf takes a Const<&str> format string, a #[poly_const]
cached ParsedFormat, and &[Value] variadic wires. The cached
ParsedFormat is computed once at construction (in the
parse_format setup-fn) so per-eval work is just iterating the
pre-parsed segments.
Structs§
- Format
Spec - One placeholder’s formatting: which argument, and how to render it.
- Parsed
Format - Pre-parsed format string cached on the
Printfnode. The#[polydat_node]macro invokesparse_formatonce at construction; eval reads the segments directly with no per-call parsing. - Printf
- Printf-style N→1 formatting node. Variadic: accepts 0..N wire inputs.
Enums§
- FmtArg
- One argument to a format, as the formatter needs it: a scalar by
value, a string by reference, anything else as the
Valuewhose display form is used. The P1 node builds these from itsValueinputs so a string argument is formatted without being copied first. - Segment
- A parsed format segment: either literal text or a placeholder.