Crate vergen_pretty

Crate vergen_pretty 

Source
Expand description

vergen-pretty - A pretty printer for vergen environment variables

Because cargo doesn’t pass compile time environment variables to dependencies, the vergen_pretty_env macro embeds a map of all the possible vergen environment variables with option_env!. Values not set in by your build.rs are skipped when pretty-printing the output.

§Example

let mut stdout = vec![];
PrettyBuilder::default()
    .env(vergen_pretty_env!())
    .build()?
    .display(&mut stdout)?;
assert!(!stdout.is_empty());

See the Pretty documentation for more examples

If you enable the header feature, you can also use the header() function with the associated Config as a convenience wrapper around Pretty.

§Example

let mut buf = vec![];
let config = ConfigBuilder::default()
    .style(Style::new().green())
    .prefix("HEADER_PREFIX")
    .env(vergen_pretty_env!())
    .suffix("HEADER_SUFFIX")
    .build()?;
assert!(header(&config, Some(&mut buf)).is_ok());
assert!(!buf.is_empty());

§Features

vergen-pretty has two feature toggles allowing you to customize your output. No features are enabled by default. You must specifically enable the features you wish to use.

FeatureEnables
colorColorize output, allow configuration of coloring via console
headerGenerate pretty printed header output based on the given Config
traceEnable support for tracing output

Macros§

vergen_pretty_env
Used to initialize env in PrettyBuilder

Structs§

Configheader
Convenience configuration around crate::Pretty to ease output generation.
ConfigBuilderheader
Builder for Config.
Leveltrace
Describes the level of verbosity of a span or event.
Prefix
Configure prefix output for PrettyBuilder
PrefixBuilder
Builder for Prefix.
Pretty
Configuration for vergen environment variable pretty printing
PrettyBuilder
Builder for Pretty.
Stylecolor
A stored style that can be applied.
Suffix
Configure suffix output for PrettyBuilder
SuffixBuilder
Builder for Suffix.

Enums§

PrettyBuilderError
Error type for PrettyBuilder

Functions§

headerheader
Generate a pretty header based off your emitted vergen variables.

Type Aliases§

Envheader
Environment tree type alias