pub struct Pretty { /* private fields */ }Expand description
Configuration for vergen environment variable pretty printing
Build this with Pretty
§Display
let mut stdout = vec![];
Pretty::builder()
.env(vergen_pretty_env!())
.build()
.display(&mut stdout)?;§Trace
Generate tracing output
Pretty::builder()
.env(vergen_pretty_env!())
.build()
.trace();§Output a prefix/suffix
Prefix and Suffix also have configurable styles if you enable
the color feature
const TEST_PREFIX: &str = r#"A wonderful introduction
"#;
const TEST_SUFFIX: &str = r#"An outro"#;
let mut stdout = vec![];
let prefix = Prefix::builder()
.lines(TEST_PREFIX.lines().map(str::to_string).collect())
.build();
let suffix = Suffix::builder()
.lines(TEST_SUFFIX.lines().map(str::to_string).collect())
.build();
Pretty::builder()
.env(vergen_pretty_env!())
.prefix(prefix)
.suffix(suffix)
.build()
.display(&mut stdout)?;§Customize Colorized Output
Uses Style to colorize output
let mut stdout = vec![];
let red_bold = Style::new().bold().red();
let yellow_bold = Style::new().bold().yellow();
Pretty::builder()
.env(vergen_pretty_env!())
.key_style(red_bold)
.value_style(yellow_bold)
.build()
.display(&mut stdout)?;Implementations§
Trait Implementations§
impl StructuralPartialEq for Pretty
Auto Trait Implementations§
impl Freeze for Pretty
impl RefUnwindSafe for Pretty
impl Send for Pretty
impl Sync for Pretty
impl Unpin for Pretty
impl UnwindSafe for Pretty
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more