pub struct Theme { /* private fields */ }Expand description
Output theme controlling symbols and formatting
A theme defines the visual appearance of user-facing messages through configurable symbols. Themes enable consistent styling across all output and support different environments (terminals, CI/CD, accessibility needs).
§Predefined Themes
- Emoji (default): Unicode emoji symbols for interactive terminals
- Plain: Text labels like
[INFO],[OK]for CI/CD environments - ASCII: Basic ASCII characters for limited terminal support
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::Theme;
// Use emoji theme (default)
let theme = Theme::emoji();
assert_eq!(theme.progress_symbol(), "⏳");
// Use plain text theme for CI/CD
let theme = Theme::plain();
assert_eq!(theme.success_symbol(), "[OK]");
// Use ASCII theme for limited terminals
let theme = Theme::ascii();
assert_eq!(theme.error_symbol(), "[x]");Implementations§
Source§impl Theme
impl Theme
Sourcepub fn emoji() -> Self
pub fn emoji() -> Self
Create emoji theme with Unicode symbols (default)
Best for interactive terminals with good Unicode support. Uses emoji characters that are visually distinctive and widely supported.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::Theme;
let theme = Theme::emoji();
assert_eq!(theme.progress_symbol(), "⏳");
assert_eq!(theme.success_symbol(), "✅");
assert_eq!(theme.warning_symbol(), "⚠️");
assert_eq!(theme.error_symbol(), "❌");Sourcepub fn plain() -> Self
pub fn plain() -> Self
Create plain text theme for CI/CD environments
Uses text labels like [INFO], [OK], [WARN], [ERROR] that work
in any environment without Unicode support. Ideal for CI/CD pipelines
and log aggregation systems.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::Theme;
let theme = Theme::plain();
assert_eq!(theme.progress_symbol(), "[INFO]");
assert_eq!(theme.success_symbol(), "[OK]");
assert_eq!(theme.warning_symbol(), "[WARN]");
assert_eq!(theme.error_symbol(), "[ERROR]");Sourcepub fn ascii() -> Self
pub fn ascii() -> Self
Create ASCII-only theme using basic characters
Uses simple ASCII characters that work on any terminal. Good for environments with limited character set support or when maximum compatibility is required.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::Theme;
let theme = Theme::ascii();
assert_eq!(theme.progress_symbol(), "=>");
assert_eq!(theme.success_symbol(), "[+]");
assert_eq!(theme.warning_symbol(), "[!]");
assert_eq!(theme.error_symbol(), "[x]");Sourcepub fn progress_symbol(&self) -> &str
pub fn progress_symbol(&self) -> &str
Get the progress symbol for this theme
Sourcepub fn success_symbol(&self) -> &str
pub fn success_symbol(&self) -> &str
Get the success symbol for this theme
Sourcepub fn warning_symbol(&self) -> &str
pub fn warning_symbol(&self) -> &str
Get the warning symbol for this theme
Sourcepub fn error_symbol(&self) -> &str
pub fn error_symbol(&self) -> &str
Get the error symbol for this theme
Sourcepub fn detail_symbol(&self) -> &str
pub fn detail_symbol(&self) -> &str
Get the detail symbol for this theme (verbose progress)
Sourcepub fn debug_symbol(&self) -> &str
pub fn debug_symbol(&self) -> &str
Get the debug symbol for this theme (debug-level details)
Trait Implementations§
impl Eq for Theme
impl StructuralPartialEq for Theme
Auto Trait Implementations§
impl Freeze for Theme
impl RefUnwindSafe for Theme
impl Send for Theme
impl Sync for Theme
impl Unpin for Theme
impl UnsafeUnpin for Theme
impl UnwindSafe for Theme
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request