DialogWidget

Struct DialogWidget 

Source
pub struct DialogWidget {
    pub dialog_type: DialogType,
    pub title: String,
    pub message: String,
    pub input: String,
    pub cursor: usize,
    pub result: DialogResult,
    pub validator: Option<fn(&str) -> bool>,
    pub error_message: Option<String>,
    pub confirmed: Option<bool>,
}
Expand description

Dialog widget

Fields§

§dialog_type: DialogType

Dialog type

§title: String

Dialog title

§message: String

Dialog message

§input: String

Input value (for input dialogs)

§cursor: usize

Cursor position

§result: DialogResult

Dialog result

§validator: Option<fn(&str) -> bool>

Validation function (for input dialogs)

§error_message: Option<String>

Error message (if validation fails)

§confirmed: Option<bool>

Confirmation state (for confirm dialogs)

Implementations§

Source§

impl DialogWidget

Source

pub fn new( dialog_type: DialogType, title: impl Into<String>, message: impl Into<String>, ) -> Self

Create a new dialog widget

Source

pub fn with_validator(self, validator: fn(&str) -> bool) -> Self

Set a validator function

Source

pub fn insert_char(&mut self, ch: char)

Insert character

Source

pub fn backspace(&mut self)

Backspace

Source

pub fn delete(&mut self)

Delete character at cursor

Source

pub fn cursor_left(&mut self)

Move cursor left

Source

pub fn cursor_right(&mut self)

Move cursor right

Source

pub fn cursor_start(&mut self)

Move cursor to start

Source

pub fn cursor_end(&mut self)

Move cursor to end

Source

pub fn get_input(&self) -> String

Get input value

Source

pub fn validate(&mut self) -> bool

Validate input

Source

pub fn confirm(&mut self)

Confirm dialog

Source

pub fn cancel(&mut self)

Cancel dialog

Source

pub fn is_confirmed(&self) -> bool

Check if dialog is confirmed

Source

pub fn is_cancelled(&self) -> bool

Check if dialog is cancelled

Source

pub fn is_pending(&self) -> bool

Check if dialog is pending

Source

pub fn clear_input(&mut self)

Clear input

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more