pub struct StepsMessageBuilder { /* private fields */ }Expand description
Builder for constructing StepsMessage with a fluent API
Provides a consuming builder pattern for constructing step messages
with optional customization. Use this for complex cases where items
are added dynamically or for improved readability. Simple cases can
use StepsMessage::new() directly.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::StepsMessage;
let message = StepsMessage::builder("Next steps:")
.add("Edit configuration")
.add("Review settings")
.add("Deploy changes")
.build();Empty builders are valid:
use torrust_tracker_deployer_lib::presentation::cli::views::StepsMessage;
let message = StepsMessage::builder("Title").build();Implementations§
Source§impl StepsMessageBuilder
impl StepsMessageBuilder
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::StepsMessageBuilder;
let builder = StepsMessageBuilder::new("My steps:");Sourcepub fn add(self, step: impl Into<String>) -> Self
pub fn add(self, step: impl Into<String>) -> Self
Add a step to the list (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::StepsMessage;
let message = StepsMessage::builder("Steps:")
.add("First step")
.add("Second step")
.build();Sourcepub fn build(self) -> StepsMessage
pub fn build(self) -> StepsMessage
Build the final StepsMessage
Consumes the builder and produces the final message.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::StepsMessage;
let message = StepsMessage::builder("Steps:")
.add("Step 1")
.build();Auto Trait Implementations§
impl Freeze for StepsMessageBuilder
impl RefUnwindSafe for StepsMessageBuilder
impl Send for StepsMessageBuilder
impl Sync for StepsMessageBuilder
impl Unpin for StepsMessageBuilder
impl UnsafeUnpin for StepsMessageBuilder
impl UnwindSafe for StepsMessageBuilder
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