pub struct StepsMessage {
pub title: String,
pub items: Vec<String>,
}Expand description
Steps message for sequential instructions
Steps messages display numbered lists of sequential items. Useful for showing action items or instructions.
§Examples
Simple constructor for cases where you have all items upfront:
use torrust_tracker_deployer_lib::presentation::cli::views::StepsMessage;
let message = StepsMessage::new("Next steps:", vec![
"Edit the configuration file".to_string(),
"Review the settings".to_string(),
]);Builder pattern for dynamic construction or better readability:
use torrust_tracker_deployer_lib::presentation::cli::views::StepsMessage;
let message = StepsMessage::builder("Next steps:")
.add("Edit the configuration file")
.add("Review the settings")
.build();Fields§
§title: StringThe title for the steps list
items: Vec<String>The list of step items
Implementations§
Source§impl StepsMessage
impl StepsMessage
Sourcepub fn new(title: impl Into<String>, items: Vec<String>) -> Self
pub fn new(title: impl Into<String>, items: Vec<String>) -> Self
Create a new steps message with the given title and items
This is a convenience constructor for simple cases where you have
all items upfront. For dynamic construction or better readability,
consider using StepsMessage::builder() instead.
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::StepsMessage;
let msg = StepsMessage::new("Next steps:", vec![
"Edit config".to_string(),
"Run tests".to_string(),
]);Sourcepub fn builder(title: impl Into<String>) -> StepsMessageBuilder
pub fn builder(title: impl Into<String>) -> StepsMessageBuilder
Create a builder for constructing steps messages with a fluent API
The builder pattern is useful when:
- Adding items dynamically
- You want self-documenting, readable code
- Building the message in multiple steps
§Examples
use torrust_tracker_deployer_lib::presentation::cli::views::StepsMessage;
let msg = StepsMessage::builder("Next steps:")
.add("Edit configuration")
.add("Review settings")
.build();Trait Implementations§
Source§impl OutputMessage for StepsMessage
impl OutputMessage for StepsMessage
Auto Trait Implementations§
impl Freeze for StepsMessage
impl RefUnwindSafe for StepsMessage
impl Send for StepsMessage
impl Sync for StepsMessage
impl Unpin for StepsMessage
impl UnsafeUnpin for StepsMessage
impl UnwindSafe for StepsMessage
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