pub struct InfoBlockMessage {
pub title: String,
pub lines: Vec<String>,
}Expand description
Info block messages display a title followed by multiple lines of text. Useful for displaying grouped information, configuration details, or multi-line informational content.
§Examples
Simple constructor for cases where you have all lines upfront:
use torrust_tracker_deployer_lib::presentation::cli::views::InfoBlockMessage;
let message = InfoBlockMessage::new("Environment Details", vec![
"Name: production".to_string(),
"Status: running".to_string(),
]);Builder pattern for dynamic construction or better readability:
use torrust_tracker_deployer_lib::presentation::cli::views::InfoBlockMessage;
let message = InfoBlockMessage::builder("Environment Details")
.add_line("Name: production")
.add_line("Status: running")
.add_line("Uptime: 24 hours")
.build();Fields§
§title: StringThe title for the info block
lines: Vec<String>The lines of information
Implementations§
Source§impl InfoBlockMessage
impl InfoBlockMessage
Sourcepub fn new(title: impl Into<String>, lines: Vec<String>) -> Self
pub fn new(title: impl Into<String>, lines: Vec<String>) -> Self
Create a new info block message with the given title and lines
This is a convenience constructor for simple cases where you have
all lines upfront. For dynamic construction or better readability,
consider using InfoBlockMessage::builder() instead.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::InfoBlockMessage;
let msg = InfoBlockMessage::new("Configuration:", vec![
" - username: 'torrust'".to_string(),
" - port: 22".to_string(),
]);Sourcepub fn builder(title: impl Into<String>) -> InfoBlockMessageBuilder
pub fn builder(title: impl Into<String>) -> InfoBlockMessageBuilder
Create a builder for constructing info block messages with a fluent API
The builder pattern is useful when:
- Adding lines dynamically
- You want self-documenting, readable code
- Building the message in multiple steps
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::InfoBlockMessage;
let msg = InfoBlockMessage::builder("Environment Details")
.add_line("Name: production")
.add_line("Status: active")
.build();Trait Implementations§
Source§impl OutputMessage for InfoBlockMessage
impl OutputMessage for InfoBlockMessage
Auto Trait Implementations§
impl Freeze for InfoBlockMessage
impl RefUnwindSafe for InfoBlockMessage
impl Send for InfoBlockMessage
impl Sync for InfoBlockMessage
impl Unpin for InfoBlockMessage
impl UnsafeUnpin for InfoBlockMessage
impl UnwindSafe for InfoBlockMessage
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
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> ⓘ
Converts
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> ⓘ
Converts
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>
Wrap the input message
T in a tonic::Request