Skip to main content

Response

Struct Response 

Source
pub struct Response<C: ShellConfig> {
    pub message: String<256>,
    pub inline_message: bool,
    pub prefix_newline: bool,
    pub indent_message: bool,
    pub postfix_newline: bool,
    pub show_prompt: bool,
    pub exclude_from_history: bool,
    /* private fields */
}
Expand description

Command execution response with message and formatting flags. Command failures return Err(CliError::CommandFailed(msg)), not Response.

Fields§

§message: String<256>

Response message (uses C::MAX_RESPONSE buffer size)

§inline_message: bool

Message is inline (don’t echo newline after command input)

§prefix_newline: bool

Add newline before message (in response formatter)

§indent_message: bool

Indent output (2 spaces)

§postfix_newline: bool

Add newline after message

§show_prompt: bool

Display prompt after response

§exclude_from_history: bool

Prevent input from being saved to history

Implementations§

Source§

impl<C: ShellConfig> Response<C>

Source

pub fn success(message: &str) -> Self

Create success response with default formatting.

Default: include in history, show prompt, add postfix newline.

Source

pub fn success_no_history(message: &str) -> Self

Create success response that excludes input from history.

Use for commands handling sensitive data (passwords, credentials).

Source

pub fn without_history(self) -> Self

Builder method to exclude command from history (chainable).

Source

pub fn inline(self) -> Self

Builder method for inline response (appears on same line as command).

Source

pub fn with_prefix_newline(self) -> Self

Builder method to add blank line before response.

Source

pub fn indented(self) -> Self

Builder method to indent response (2 spaces per line).

Source

pub fn without_postfix_newline(self) -> Self

Builder method to suppress newline after response.

Source

pub fn without_prompt(self) -> Self

Builder method to suppress prompt after response.

Trait Implementations§

Source§

impl<C: Clone + ShellConfig> Clone for Response<C>

Source§

fn clone(&self) -> Response<C>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<C: Debug + ShellConfig> Debug for Response<C>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<C: PartialEq + ShellConfig> PartialEq for Response<C>

Source§

fn eq(&self, other: &Response<C>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<C: ShellConfig> StructuralPartialEq for Response<C>

Auto Trait Implementations§

§

impl<C> Freeze for Response<C>

§

impl<C> RefUnwindSafe for Response<C>
where C: RefUnwindSafe,

§

impl<C> Send for Response<C>
where C: Send,

§

impl<C> Sync for Response<C>
where C: Sync,

§

impl<C> Unpin for Response<C>
where C: Unpin,

§

impl<C> UnsafeUnpin for Response<C>

§

impl<C> UnwindSafe for Response<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.