Expand description
§rusty-figlet
Rust port of cmatsuoka’s figlet(6) v2.2.5 with an in-house FIGfont 2.0
parser, all six horizontal smush rules + universal, 12 bundled .flf
fonts via include_bytes!, terminal-width-aware layout, color/rainbow
output, byte-equal Strict-mode upstream compatibility, and a typed
library API.
§Library API quick tour
use rusty_figlet::{FigletBuilder, Font};
let banner = FigletBuilder::new()
.font(Font::Standard)
.width(80)
.build()
.expect("build")
.render("Hello")
.expect("render");
for line in banner.lines() {
println!("{line}");
}§Default features
default = ["full"] enables every leaf (the kitchen-sink experience)
plus the CLI binary surface (clap, clap_complete, anstyle, termcolor,
terminal_size). Library consumers should depend on rusty-figlet with
default-features = false to strip every CLI-only dep so only
thiserror and the in-house FIGfont parser are pulled in.
See the README “Cargo Features” section + ADR-0006 for the full leaf
inventory, preset bundles (figlet-classic, figlet-minimal,
figlet-toilet-compat), and the keep-list workaround.
§Error handling
FigletError is #[non_exhaustive]; downstream pattern matches MUST
include a wildcard _ arm (per AD-013).
Modules§
- strict
strict-compat - Hand-rolled Strict-mode argv parser (AD-007). Public so the
rusty-figletbinary can dispatch to its byte-equal upstream diagnostics; the SemVer policy on this module’s surface matches the rest of the public library API per FR-050. Gated by thestrict-compatleaf (v0.2+). Hand-rolled Strict-mode argv parser per AD-007.
Structs§
- Banner
- A rendered ASCII-art banner.
- Figlet
- A reusable renderer holding a parsed
Fontand resolved layout settings. - Figlet
Builder - Fluent builder for
Figletrenderers. - Justify
Flags - Sequenced justify-flag occurrences from the command line.
- Layout
Flags - Sequenced layout-flag occurrences from the command line.
Enums§
- Compatibility
Mode - Compatibility mode that governs argv parsing + rendering rules.
- Figlet
Error - All fallible operations in
rusty-figletreturnResult<T, FigletError>. - Font
- Bundled-font selector and external-file escape hatch.
- Justify
- Horizontal justification mode.
- Justify
Flag - One occurrence of a justify-class flag, captured in argv order.
- Layout
Flag - One occurrence of a layout-class flag, captured in argv order so
LayoutResolver::resolvecan apply last-wins semantics per FR-023.
Functions§
- clamp_
input_ latin1 - Clamp UTF-8 input down to Latin-1 (ISO-8859-1) bytes per FR-044.
- resolve_
justify_ for - Re-export of [
layout::resolve_justify] for the rusty-figlet binary’s CLI wiring path (T103 + T109). Translates a sequence ofJustifyFlagoccurrences into the resolvedJustifyvalue via last-wins semantics per FR-022. - resolve_
width_ for terminal-width - Re-export of [
width::resolve_width] for the rusty-figlet binary’s CLI wiring path. Library consumers that need to resolve a width budget under the same precedence ladder may call this helper directly. Gated by theterminal-widthleaf because the underlying lookup depends onterminal_size.