Expand description
Provides pretty-printing capabilities for Facet types.
Example:
use facet::Facet;
use facet_pretty::FacetPretty;
#[derive(Debug, Facet)]
struct Person {
name: String,
age: u32,
}
let person = Person {
name: "Alice".to_string(),
age: 30,
};
println!("Default pretty-printing:");
println!("{}", person.pretty());Produces the output:
Person {
name: "Alice",
age: 30,
}§Sponsors
Thanks to all individual sponsors:
…along with corporate sponsors:
…without whom this work could not exist.
§Special thanks
The facet logo was drawn by Misiasart.
§License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Modules§
- colors
- Melange syntax highlighting for the type-definition view.
- tokyo_
night - Tokyo Night color palette (RGB values from official theme).
Structs§
- Color
Generator Deprecated - A color generator that produces unique colors based on a hash value.
- Field
Span - Spans for a field or variant, tracking both key (name) and value (type) positions
- Formatted
Shape - Result of formatting a shape with span tracking
- Formatted
Value - Result of formatting a value with span tracking
- Palette
- A complete set of semantic colours used by the pretty-printer.
- Pretty
Display - Display wrapper for any type that implements Facet.
- Pretty
Printer - A formatter for pretty-printing Facet types
- RGB
Deprecated - RGB color representation.
- Shape
Format Config - Configuration options for shape formatting
Enums§
- Color
Mode - Color mode for the pretty printer.
- Path
Segment - A segment in a path through a type structure
- Theme
- Which colour palette the pretty-printer should use.
Traits§
- Facet
Pretty - Extension trait for Facet types to easily pretty-print them
Functions§
- detected_
palette - The palette chosen by
Theme::Auto, detected once per process. - format_
shape - Format a Shape as Rust-like source code (plain text, no colors)
- format_
shape_ colored - Format a Shape as Rust-like source code with ANSI colors (Tokyo Night theme)
- format_
shape_ colored_ into - Format a Shape with ANSI colors into an existing String
- format_
shape_ colored_ into_ with_ config - Format a Shape with ANSI colors into an existing String with config options
- format_
shape_ colored_ with_ config - Format a Shape as Rust-like source code with ANSI colors and config options
- format_
shape_ with_ config - Format a Shape as Rust-like source code with config options (plain text, no colors)
- format_
shape_ with_ spans - Format a Shape with span tracking for each field/variant Note: spans are computed on the plain text (no ANSI codes)
- format_
shape_ with_ spans_ and_ config - Format a Shape with span tracking and config options Note: spans are computed on the plain text (no ANSI codes)
- strip_
ansi - Strip ANSI escape codes from a string