pub struct InfoBlockMessageBuilder { /* private fields */ }Expand description
Builder for constructing InfoBlockMessage with a fluent API
Provides a consuming builder pattern for constructing info block messages
with optional customization. Use this for complex cases where lines
are added dynamically or for improved readability. Simple cases can
use InfoBlockMessage::new() directly.
§Examples
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();Empty builders are valid:
use torrust_tracker_deployer_lib::presentation::cli::views::InfoBlockMessage;
let message = InfoBlockMessage::builder("Title").build();Implementations§
Source§impl InfoBlockMessageBuilder
impl InfoBlockMessageBuilder
Sourcepub fn new(title: impl Into<String>) -> Self
pub fn new(title: impl Into<String>) -> Self
Create a new builder with the given title
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::InfoBlockMessageBuilder;
let builder = InfoBlockMessageBuilder::new("My info block:");Sourcepub fn add_line(self, line: impl Into<String>) -> Self
pub fn add_line(self, line: impl Into<String>) -> Self
Add a line to the info block (consuming self for method chaining)
This method consumes the builder and returns it, enabling method chaining in a fluent API style.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::InfoBlockMessage;
let message = InfoBlockMessage::builder("Info:")
.add_line("First line")
.add_line("Second line")
.build();Sourcepub fn build(self) -> InfoBlockMessage
pub fn build(self) -> InfoBlockMessage
Build the final InfoBlockMessage
Consumes the builder and produces the final message.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::InfoBlockMessage;
let message = InfoBlockMessage::builder("Info:")
.add_line("Line 1")
.build();Auto Trait Implementations§
impl Freeze for InfoBlockMessageBuilder
impl RefUnwindSafe for InfoBlockMessageBuilder
impl Send for InfoBlockMessageBuilder
impl Sync for InfoBlockMessageBuilder
impl Unpin for InfoBlockMessageBuilder
impl UnsafeUnpin for InfoBlockMessageBuilder
impl UnwindSafe for InfoBlockMessageBuilder
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