pub struct Ui<W: Write> {
pub(crate) out: BufWriter<W>,
pub(crate) err: Box<dyn Write>,
pub(crate) color_enabled: bool,
pub(crate) default_yes: bool,
pub(crate) spinner_style: Arc<ProgressStyle>,
pub(crate) progress_style: Arc<ProgressStyle>,
}Expand description
Terminal-backed presentation state used by CLI command handlers.
Fields§
§out: BufWriter<W>§err: Box<dyn Write>§color_enabled: bool§default_yes: bool§spinner_style: Arc<ProgressStyle>§progress_style: Arc<ProgressStyle>Implementations§
Source§impl<W: Write> Ui<W>
impl<W: Write> Ui<W>
pub fn page_title(&mut self, title: &str)
pub fn confirm(&mut self, message: &str, default: bool) -> Result<bool>
pub fn prompt_text( &mut self, message: &str, default: Option<&str>, ) -> Result<String>
pub fn prompt_number(&mut self, message: &str, max: usize) -> Result<usize>
pub fn select_index(&mut self, message: &str, items: &[String]) -> Result<usize>
Source§impl<W: Write> Ui<W>
impl<W: Write> Ui<W>
pub fn write_line(&mut self, message: impl Display)
pub fn info(&mut self, message: impl Display)
Sourcepub fn notice(&mut self, message: impl Display)
pub fn notice(&mut self, message: impl Display)
notice is reserved for neutral status messages; may gain distinct
formatting in future (e.g. dimmed). Prefer info for general output.
pub fn warn(&mut self, message: impl AsRef<str>)
pub fn error(&mut self, message: impl AsRef<str>)
pub fn success(&mut self, message: impl AsRef<str>)
Source§impl<W: Write> Ui<W>
impl<W: Write> Ui<W>
pub fn progress_bar(&self) -> ProgressHandle
pub fn start_spinner(&self, message: impl Into<String>) -> SpinnerGuard
pub fn spinner<T, F: FnOnce() -> T>( &self, message: impl Into<String>, f: F, ) -> T
Source§impl<W: Write> Ui<W>
impl<W: Write> Ui<W>
fn render_table(&mut self, table: Table)
pub fn display_packages(&mut self, packages: &[InstalledPackage])
pub fn display_catalog_packages(&mut self, packages: &[CatalogPackage])
pub fn display_key_values(&mut self, rows: &[(String, String)])
fn build_table(&self, headers: impl IntoIterator<Item = Cell>) -> Table
fn render_section_label(&mut self, label: &str)
Source§impl Ui<Stdout>
impl Ui<Stdout>
Sourcepub fn new(settings: UiSettings) -> Self
pub fn new(settings: UiSettings) -> Self
Create a UI that writes to stdout and stderr.
Source§impl<W: Write> Ui<W>
impl<W: Write> Ui<W>
Sourcepub fn with_writer(writer: W, settings: UiSettings) -> Self
pub fn with_writer(writer: W, settings: UiSettings) -> Self
Create a UI with an explicit writer, which is primarily useful in tests.
Trait Implementations§
Auto Trait Implementations§
impl<W> Freeze for Ui<W>where
W: Freeze,
impl<W> !RefUnwindSafe for Ui<W>
impl<W> !Send for Ui<W>
impl<W> !Sync for Ui<W>
impl<W> Unpin for Ui<W>where
W: Unpin,
impl<W> !UnwindSafe for Ui<W>
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