pub struct DialogData<D = ()> {
pub title: String,
pub message: String,
pub buttons: Vec<String>,
pub purpose: Option<D>,
pub is_loading: bool,
}Expand description
The content of a modal dialog.
D is an application-owned “purpose” payload (often an enum) that the app
uses to tell apart which dialog was answered. It is opaque to the library.
DialogData is stored as the focus manager’s dialog payload via
DialogData::show_intent; the
focus manager tracks which button is active and navigates between them.
Fields§
§title: String§message: String§purpose: Option<D>§is_loading: boolImplementations§
Source§impl<D> DialogData<D>
impl<D> DialogData<D>
Sourcepub fn new(
title: impl Into<String>,
message: impl Into<String>,
buttons: impl IntoIterator<Item = impl Into<String>>,
purpose: D,
) -> Self
pub fn new( title: impl Into<String>, message: impl Into<String>, buttons: impl IntoIterator<Item = impl Into<String>>, purpose: D, ) -> Self
A dialog with a title, message, selectable buttons, and a purpose used to interpret the selection.
Sourcepub fn loading(title: impl Into<String>, message: impl Into<String>) -> Self
pub fn loading(title: impl Into<String>, message: impl Into<String>) -> Self
A buttonless “please wait” dialog. Replace it with DialogData::new
(via show_intent) once the work completes.
Source§impl<D> DialogData<D>
impl<D> DialogData<D>
Sourcepub fn show_intent<O>(self) -> FocusIntent<O, DialogData<D>>
pub fn show_intent<O>(self) -> FocusIntent<O, DialogData<D>>
The focus intent that opens this dialog as a modal overlay. Wrap it in
TuiEffect::Focus (or apply it directly to a
FocusManager). O is the app’s overlay type and is inferred from
the surrounding runtime.
Trait Implementations§
Source§impl<D: Clone> Clone for DialogData<D>
impl<D: Clone> Clone for DialogData<D>
Source§fn clone(&self) -> DialogData<D>
fn clone(&self) -> DialogData<D>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<D: Debug> Debug for DialogData<D>
impl<D: Debug> Debug for DialogData<D>
Source§impl<D: PartialEq> PartialEq for DialogData<D>
impl<D: PartialEq> PartialEq for DialogData<D>
Source§fn eq(&self, other: &DialogData<D>) -> bool
fn eq(&self, other: &DialogData<D>) -> bool
self and other values to be equal, and is used by ==.impl<D: Eq> Eq for DialogData<D>
impl<D> StructuralPartialEq for DialogData<D>
Auto Trait Implementations§
impl<D> Freeze for DialogData<D>where
D: Freeze,
impl<D> RefUnwindSafe for DialogData<D>where
D: RefUnwindSafe,
impl<D> Send for DialogData<D>where
D: Send,
impl<D> Sync for DialogData<D>where
D: Sync,
impl<D> Unpin for DialogData<D>where
D: Unpin,
impl<D> UnsafeUnpin for DialogData<D>where
D: UnsafeUnpin,
impl<D> UnwindSafe for DialogData<D>where
D: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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>
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>
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