Skip to main content

Crate rusty_figlet

Crate rusty_figlet 

Source
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§

strictstrict-compat
Hand-rolled Strict-mode argv parser (AD-007). Public so the rusty-figlet binary 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 the strict-compat leaf (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 Font and resolved layout settings.
FigletBuilder
Fluent builder for Figlet renderers.
JustifyFlags
Sequenced justify-flag occurrences from the command line.
LayoutFlags
Sequenced layout-flag occurrences from the command line.

Enums§

CompatibilityMode
Compatibility mode that governs argv parsing + rendering rules.
FigletError
All fallible operations in rusty-figlet return Result<T, FigletError>.
Font
Bundled-font selector and external-file escape hatch.
Justify
Horizontal justification mode.
JustifyFlag
One occurrence of a justify-class flag, captured in argv order.
LayoutFlag
One occurrence of a layout-class flag, captured in argv order so LayoutResolver::resolve can 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 of JustifyFlag occurrences into the resolved Justify value via last-wins semantics per FR-022.
resolve_width_forterminal-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 the terminal-width leaf because the underlying lookup depends on terminal_size.