pub struct Ui { /* private fields */ }Implementations§
source§impl Ui
impl Ui
pub fn with_config(config: &Config) -> Result<Ui, CommandError>
pub fn reset(&mut self, config: &Config) -> Result<(), CommandError>
sourcepub fn request_pager(&mut self)
pub fn request_pager(&mut self)
Switches the output to use the pager, if allowed.
pub fn color(&self) -> bool
pub fn new_formatter<'output, W: Write + 'output>( &self, output: W ) -> Box<dyn Formatter + 'output>
sourcepub fn stdout_formatter(&self) -> Box<dyn Formatter + '_>
pub fn stdout_formatter(&self) -> Box<dyn Formatter + '_>
Creates a formatter for the locked stdout stream.
Labels added to the returned formatter should be removed by caller. Otherwise the last color would persist.
sourcepub fn stderr_formatter(&self) -> Box<dyn Formatter + '_>
pub fn stderr_formatter(&self) -> Box<dyn Formatter + '_>
Creates a formatter for the locked stderr stream.
sourcepub fn stderr_for_child(&self) -> Result<Stdio>
pub fn stderr_for_child(&self) -> Result<Stdio>
Stderr stream to be attached to a child process.
sourcepub fn use_progress_indicator(&self) -> bool
pub fn use_progress_indicator(&self) -> bool
Whether continuous feedback should be displayed for long-running operations
pub fn progress_output(&self) -> Option<ProgressOutput>
sourcepub fn status(&self) -> Box<dyn Write + '_>
pub fn status(&self) -> Box<dyn Write + '_>
Writer to print an update that’s not part of the command’s main output.
sourcepub fn status_formatter(&self) -> Option<Box<dyn Formatter + '_>>
pub fn status_formatter(&self) -> Option<Box<dyn Formatter + '_>>
A formatter to print an update that’s not part of the command’s main
output. Returns None if --quiet was requested.
sourcepub fn hint_default(
&self
) -> Option<HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, &'static str>>
pub fn hint_default( &self ) -> Option<HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, &'static str>>
Writer to print hint with the default “Hint: “ heading.
sourcepub fn hint_no_heading(
&self
) -> Option<LabeledWriter<Box<dyn Formatter + '_>, &'static str>>
pub fn hint_no_heading( &self ) -> Option<LabeledWriter<Box<dyn Formatter + '_>, &'static str>>
Writer to print hint without the “Hint: “ heading.
sourcepub fn hint_with_heading<H: Display>(
&self,
heading: H
) -> Option<HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, H>>
pub fn hint_with_heading<H: Display>( &self, heading: H ) -> Option<HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, H>>
Writer to print hint with the given heading.
sourcepub fn warning_default(
&self
) -> HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, &'static str>
pub fn warning_default( &self ) -> HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, &'static str>
Writer to print warning with the default “Warning: “ heading.
sourcepub fn warning_no_heading(
&self
) -> LabeledWriter<Box<dyn Formatter + '_>, &'static str>
pub fn warning_no_heading( &self ) -> LabeledWriter<Box<dyn Formatter + '_>, &'static str>
Writer to print warning without the “Warning: “ heading.
sourcepub fn warning_with_heading<H: Display>(
&self,
heading: H
) -> HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, H>
pub fn warning_with_heading<H: Display>( &self, heading: H ) -> HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, H>
Writer to print warning with the given heading.
sourcepub fn error_no_heading(
&self
) -> LabeledWriter<Box<dyn Formatter + '_>, &'static str>
pub fn error_no_heading( &self ) -> LabeledWriter<Box<dyn Formatter + '_>, &'static str>
Writer to print error without the “Error: “ heading.
sourcepub fn error_with_heading<H: Display>(
&self,
heading: H
) -> HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, H>
pub fn error_with_heading<H: Display>( &self, heading: H ) -> HeadingLabeledWriter<Box<dyn Formatter + '_>, &'static str, H>
Writer to print error with the given heading.
sourcepub fn finalize_pager(&mut self)
pub fn finalize_pager(&mut self)
Waits for the pager exits.
pub fn can_prompt() -> bool
pub fn prompt(&self, prompt: &str) -> Result<String>
sourcepub fn prompt_choice(
&self,
prompt: &str,
choices: &[impl AsRef<str>],
default: Option<&str>
) -> Result<String>
pub fn prompt_choice( &self, prompt: &str, choices: &[impl AsRef<str>], default: Option<&str> ) -> Result<String>
Repeat the given prompt until the input is one of the specified choices.
sourcepub fn prompt_yes_no(&self, prompt: &str, default: Option<bool>) -> Result<bool>
pub fn prompt_yes_no(&self, prompt: &str, default: Option<bool>) -> Result<bool>
Prompts for a yes-or-no response, with yes = true and no = false.
pub fn prompt_password(&self, prompt: &str) -> Result<String>
pub fn term_width(&self) -> Option<u16>
Auto Trait Implementations§
impl Freeze for Ui
impl !RefUnwindSafe for Ui
impl Send for Ui
impl Sync for Ui
impl Unpin for Ui
impl !UnwindSafe for Ui
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more