Struct Question

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

A question dialog box.

This dialog box displays a text and an optional title and has a yes and a no button. The output is the button presed by the user, or Cancel if the dialog has been cancelled.

§Example

use dialog::DialogBox;

let choice = dialog::Question::new("Do you want to continue?")
    .title("Question")
    .show()
    .expect("Could not display dialog box");
println!("The user chose: {:?}", choice);

Implementations§

Source§

impl Question

Source

pub fn new(text: impl Into<String>) -> Question

Creates a new question dialog with the given text.

Examples found in repository?
examples/question.rs (line 7)
6fn main() -> dialog::Result<()> {
7    let choice = dialog::Question::new("Do you want to continue?").show()?;
8    println!("The user chose: {:?}", choice);
9    Ok(())
10}
Source

pub fn title(&mut self, title: impl Into<String>) -> &mut Question

Sets the title of this question dialog box.

This method returns a reference to self to enable chaining.

Trait Implementations§

Source§

impl DialogBox for Question

Source§

type Output = Choice

The type of the data returned by the dialog box.
Source§

fn show_with<B>(&self, backend: impl AsRef<B>) -> Result<Self::Output>
where B: Backend + ?Sized,

Shows this dialog box using the given backend and returns the output.
Source§

fn show(&self) -> Result<Self::Output>

Shows this dialog box using the default backend and returns the output. Read more

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.