Struct smart_config_commands::Printer
source · pub struct Printer<W: RawStream> { /* private fields */ }
Expand description
Wrapper around an I/O writer. Will style the output with ANSI sequences if appropriate.
Internally, the printer is based on anstream
/ anstyle
; see their docs to find out how styling support
is detected by default. (TL;DR: based on NO_COLOR
, CLICOLOR_FORCE
and CLICOLOR
env vars, and whether
the output is a terminal.) If this detection doesn’t work for you, you can always create a fully custom Printer
.
Implementations§
source§impl<W: RawStream + AsLockedWrite> Printer<W>
impl<W: RawStream + AsLockedWrite> Printer<W>
sourcepub fn print_debug(
self,
repo: &ConfigRepository<'_>,
filter: impl FnMut(ParamRef<'_>) -> bool,
) -> Result<Result<(), ParseErrors>>
pub fn print_debug( self, repo: &ConfigRepository<'_>, filter: impl FnMut(ParamRef<'_>) -> bool, ) -> Result<Result<(), ParseErrors>>
Prints debug info for all param values in the provided repo
. If params fail to deserialize,
corresponding error(s) are output as well.
§Errors
- Propagates I/O errors.
- Returns the exhaustive parsing result. Depending on the application, some parsing errors (e.g., missing params for optional configs) may not be fatal.
source§impl<W: RawStream + AsLockedWrite> Printer<W>
impl<W: RawStream + AsLockedWrite> Printer<W>
sourcepub fn print_help(
self,
schema: &ConfigSchema,
filter: impl FnMut(ParamRef<'_>) -> bool,
) -> Result<()>
pub fn print_help( self, schema: &ConfigSchema, filter: impl FnMut(ParamRef<'_>) -> bool, ) -> Result<()>
Prints help on config params in the provided schema
. Params can be filtered by the supplied predicate.
§Errors
Propagates I/O errors.
source§impl Printer<StdoutLock<'static>>
impl Printer<StdoutLock<'static>>
source§impl Printer<StderrLock<'static>>
impl Printer<StderrLock<'static>>
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for Printer<W>where
W: Freeze,
impl<W> RefUnwindSafe for Printer<W>where
W: RefUnwindSafe,
impl<W> Send for Printer<W>where
W: Send,
impl<W> Sync for Printer<W>where
W: Sync,
impl<W> Unpin for Printer<W>where
W: Unpin,
impl<W> UnwindSafe for Printer<W>where
W: UnwindSafe,
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