[−][src]Struct dialog::FileSelection
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]
Auto Trait Implementations
impl Send for FileSelection
impl Sync for FileSelection
impl Unpin for FileSelection
impl UnwindSafe for FileSelection
impl RefUnwindSafe for FileSelection
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,