Skip to main content

FileDialog

Struct FileDialog 

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

One file dialog, built and then shown.

Implementations§

Source§

impl FileDialog

Source

pub fn open_file() -> Self

Choose one file.

Source

pub fn open_files() -> Self

Choose one or more files.

Source

pub fn open_folder() -> Self

Choose one folder.

Source

pub fn open_folders() -> Self

Choose one or more folders.

Source

pub fn save() -> Self

Choose a path to save to. The platform asks before overwriting; the Renderer only hands back the path and never writes the file.

Source

pub fn title(self, title: impl Into<String>) -> Self

The dialog’s title. Empty is the platform’s default.

Source

pub fn directory(self, directory: impl Into<String>) -> Self

The folder the dialog opens in. It should be absolute. One that is empty, missing or unreadable falls back to the platform’s default, and is not an error.

Source

pub fn name(self, name: impl Into<String>) -> Self

The file name a save dialog starts with. Ignored by the open kinds. A path separator in it keeps only what follows the last one.

Source

pub fn filter(self, label: impl Into<String>, extensions: &[&str]) -> Self

Adds a filter: a label and the extensions it allows, without dots and compared without regard to case. Ignored when choosing folders. Without any filter every file can be chosen.

Source

pub fn default_filter(self, position: usize) -> Self

The position of the filter selected first. A position past the last filter selects the first.

Source

pub fn window(self, node_id: u32) -> Self

The Window node the dialog belongs to and is modal for. 0 is the implicit root window of an application with one window.

Source

pub fn in_window(self, window: WindowHandle) -> Self

The window the dialog belongs to, by handle.

Source

pub fn show(self, on_result: impl FnOnce(FileDialogResult) + 'static)

Asks for the dialog. on_result is called once, on the UI thread, when it ends, and is then dropped.

Call this on the UI thread, from a component or an event handler. From a worker use FileDialogSender.

Trait Implementations§

Source§

impl Clone for FileDialog

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileDialog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FileDialog

Source§

impl PartialEq for FileDialog

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileDialog

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.