Skip to main content

DatePrompt

Struct DatePrompt 

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

Builder returned by date().

Implementations§

Source§

impl DatePrompt

Source

pub fn initial(self, d: Date) -> Self

Initial date shown (default: today).

Source

pub fn min(self, d: Date) -> Self

Reject dates earlier than d.

Source

pub fn max(self, d: Date) -> Self

Reject dates later than d.

Source

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

Run the prompt to completion.

Trait Implementations§

Source§

impl Prompt for DatePrompt

Source§

type Output = Date

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

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

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: &Date) -> Frame

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

fn run_fallback(self) -> Result<Date>

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.