pub struct FileDialog {
pub title: String,
pub default_path: Option<String>,
pub filters: Vec<FileFilter>,
pub mode: FileDialogMode,
pub allow_multiple: bool,
}Expand description
Dialog options for picking files or directories.
Fields§
§title: StringTitle displayed in the dialog window.
default_path: Option<String>Optional starting directory path.
filters: Vec<FileFilter>Extensions used to filter selection.
mode: FileDialogModeOpen/save mode.
allow_multiple: boolAllows selecting multiple files if in OpenFile mode.
Implementations§
Source§impl FileDialog
impl FileDialog
Sourcepub fn new(mode: FileDialogMode) -> Self
pub fn new(mode: FileDialogMode) -> Self
Creates a new FileDialog with the given mode.
Sourcepub fn add_filter(self, name: &str, extensions: &[&str]) -> Self
pub fn add_filter(self, name: &str, extensions: &[&str]) -> Self
Adds a file filter.
Sourcepub fn default_path(self, path: impl Into<String>) -> Self
pub fn default_path(self, path: impl Into<String>) -> Self
Sets the default starting directory path.
Sourcepub fn allow_multiple(self, allow: bool) -> Self
pub fn allow_multiple(self, allow: bool) -> Self
Sets whether selecting multiple files is allowed.
Source§impl FileDialog
impl FileDialog
Sourcepub fn pick(self) -> Result<Vec<PathBuf>, FileDialogError>
pub fn pick(self) -> Result<Vec<PathBuf>, FileDialogError>
Pick file(s) or folder based on current mode configuration.
Sourcepub fn pick_single(self) -> Result<Option<PathBuf>, FileDialogError>
pub fn pick_single(self) -> Result<Option<PathBuf>, FileDialogError>
Helper to pick a single file/directory, returning None if cancelled.
Trait Implementations§
Source§impl Clone for FileDialog
impl Clone for FileDialog
Source§fn clone(&self) -> FileDialog
fn clone(&self) -> FileDialog
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FileDialog
impl Debug for FileDialog
Source§impl Default for FileDialog
impl Default for FileDialog
Source§fn default() -> FileDialog
fn default() -> FileDialog
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for FileDialog
impl<'de> Deserialize<'de> for FileDialog
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for FileDialog
Source§impl PartialEq for FileDialog
impl PartialEq for FileDialog
Source§fn eq(&self, other: &FileDialog) -> bool
fn eq(&self, other: &FileDialog) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for FileDialog
impl Serialize for FileDialog
impl StructuralPartialEq for FileDialog
Auto Trait Implementations§
impl Freeze for FileDialog
impl RefUnwindSafe for FileDialog
impl Send for FileDialog
impl Sync for FileDialog
impl Unpin for FileDialog
impl UnsafeUnpin for FileDialog
impl UnwindSafe for FileDialog
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.