Skip to main content

MultilinePrompt

Struct MultilinePrompt 

Source
pub struct MultilinePrompt { /* private fields */ }
Expand description

Builder returned by multiline().

Implementations§

Source§

impl MultilinePrompt

Source

pub fn placeholder(self, v: impl Into<String>) -> Self

Dim text shown in the input area before the user types.

Source

pub fn show_submit(self, v: bool) -> Self

Show a [ submit ] button focused with Tab (default: false, which means double-Enter submits).

Source

pub fn validate<F>(self, f: F) -> Self
where F: Fn(&str) -> Result<(), String> + Send + Sync + 'static,

Validate with an ad-hoc closure.

Source

pub fn rule(self, v: Validator) -> Self

Apply a composed Validator from the rules library.

Source

pub fn validate_with(self, v: Validator) -> Self

👎Deprecated since 0.1.0:

use .rule(...) instead

Deprecated alias for rule.

Source

pub fn run(self) -> Result<String>

Run the prompt to completion.

Trait Implementations§

Source§

impl Prompt for MultilinePrompt

Source§

type Output = String

The value returned to the caller on successful submission.
Source§

fn handle(&mut self, key: Key) -> Step<String>

Apply a key press to the prompt’s internal state. Return: Read more
Source§

fn render(&self, _ctx: RenderCtx<'_>) -> Frame

Render the prompt’s current state as one frame (a Vec<String>, one entry per terminal row). The runner takes care of writing the frame and clearing it on the next iteration — prompts never call eprintln! themselves.
Source§

fn render_answered(&self, value: &String) -> Frame

Render the prompt’s post-submission display. Typically the ◇ question / │ value / │ triple from theme::answered.
Source§

fn run_fallback(self) -> Result<String>

Optional non-interactive fallback for piped/CI environments. The default is to refuse — most prompts override this with a numeric or line-buffered alternative.

Auto Trait Implementations§

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> 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.