pub struct FileDialog { /* private fields */ }Expand description
Builder for launching file dialogs
Implementations§
Source§impl FileDialog
impl FileDialog
Sourcepub fn new(mode: DialogMode) -> Self
pub fn new(mode: DialogMode) -> Self
Create a new builder with the given mode
Sourcepub fn default_file_name(self, name: impl Into<String>) -> Self
pub fn default_file_name(self, name: impl Into<String>) -> Self
Set default file name (for SaveFile)
Sourcepub fn multi_select(self, yes: bool) -> Self
pub fn multi_select(self, yes: bool) -> Self
Allow multi selection (only for OpenFiles)
Sourcepub fn max_selection(self, max: usize) -> Self
pub fn max_selection(self, max: usize) -> Self
Limit the maximum number of selected files (IGFD countSelectionMax-like).
0means “infinite” (no limit).1behaves like a single-selection dialog.
Note: native dialogs may not be able to enforce the limit interactively; results are clamped best-effort.
Show hidden files in ImGui browser (native follows OS behavior)
Sourcepub fn filter<F: Into<FileFilter>>(self, filter: F) -> Self
pub fn filter<F: Into<FileFilter>>(self, filter: F) -> Self
Add a filter.
Examples
use dear_file_browser::{FileDialog, DialogMode};
let d = FileDialog::new(DialogMode::OpenFile)
.filter(("Images", &["png", "jpg"][..]))
.filter(("Rust", &["rs"][..]))
.show_hidden(true);Sourcepub fn filters<I, F>(self, filters: I) -> Self
pub fn filters<I, F>(self, filters: I) -> Self
Add multiple filters.
The list will be appended to any previously-added filters. Extensions are compared case-insensitively and should be provided without dots.
Examples
use dear_file_browser::{FileDialog, DialogMode, FileFilter};
let filters = vec![
FileFilter::from(("Images", &["png", "jpg", "jpeg"][..]))
];
let d = FileDialog::new(DialogMode::OpenFiles)
.filters(filters)
.multi_select(true);Sourcepub fn filters_igfd(
self,
spec: impl AsRef<str>,
) -> Result<Self, IgfdFilterParseError>
pub fn filters_igfd( self, spec: impl AsRef<str>, ) -> Result<Self, IgfdFilterParseError>
Parse and add one or more IGFD-style filters.
This is a convenience wrapper over FileFilter::parse_igfd.
Source§impl FileDialog
impl FileDialog
Sourcepub fn open_blocking(self) -> Result<Selection, FileDialogError>
pub fn open_blocking(self) -> Result<Selection, FileDialogError>
Open a dialog synchronously (blocking).
Sourcepub async fn open_async(self) -> Result<Selection, FileDialogError>
pub async fn open_async(self) -> Result<Selection, FileDialogError>
Open a dialog asynchronously via rfd::AsyncFileDialog.
Trait Implementations§
Source§impl Clone for FileDialog
impl Clone for FileDialog
Source§fn clone(&self) -> FileDialog
fn clone(&self) -> FileDialog
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more