[][src]Struct dialog::FileSelection

pub struct FileSelection { /* fields omitted */ }

A file chooser dialog box.

This dialog box opens a file choser with an optional title in the specified path. If the path is not specified, it defaults to the user’s home directory.

The backends might support multiple operation modes, for example open or save dialogs. You can select a mode using the FileSelectionMode enum, though the backend might ignore the mode and just display a simple file dialog. Per default, the mode is set to Open.

Example

use dialog::DialogBox;

let choice = dialog::FileSelection::new("Please select a file")
    .title("File Selection")
    .path("/home/user/Downloads")
    .show()
    .expect("Could not display dialog box");
println!("The user chose: {:?}", choice);

Methods

impl FileSelection[src]

pub fn new(text: impl Into<String>) -> FileSelection[src]

Creates a new file chooser with the given path.

pub fn title(&mut self, title: impl Into<String>) -> &mut FileSelection[src]

Sets the title of this file chooser dialog box.

This method returns a reference to self to enable chaining.

pub fn path(&mut self, path: impl AsRef<Path>) -> &mut FileSelection[src]

Sets the path of this file chooser dialog box.

This method returns a reference to self to enable chaining.

pub fn path_to_string(&self) -> Option<String>[src]

Gets the path of this file chooser dialog box.

This method returns the validated directory as a String.

pub fn mode(&mut self, mode: FileSelectionMode) -> &mut FileSelection[src]

Sets the operation mode of the file chooser.

This method returns a reference to self to enable chaining.

Trait Implementations

impl DialogBox for FileSelection[src]

type Output = Option<String>

The type of the data returned by the dialog box.

Auto Trait Implementations

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = !

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]