pub struct FileDialogBuilder(_);
dialog
only.Expand description
The file dialog builder.
Constructs file picker dialogs that can select single/multiple files or directories.
Implementations
sourceimpl FileDialogBuilder
impl FileDialogBuilder
sourcepub fn add_filter(self, name: impl AsRef<str>, extensions: &[&str]) -> Self
pub fn add_filter(self, name: impl AsRef<str>, extensions: &[&str]) -> Self
Add file extension filter. Takes in the name of the filter, and list of extensions
sourcepub fn set_directory<P: AsRef<Path>>(self, directory: P) -> Self
pub fn set_directory<P: AsRef<Path>>(self, directory: P) -> Self
Set starting directory of the dialog.
sourcepub fn set_file_name(self, file_name: &str) -> Self
pub fn set_file_name(self, file_name: &str) -> Self
Set starting file name of the dialog.
sourcepub fn set_parent<W: HasRawWindowHandle>(self, parent: &W) -> Self
pub fn set_parent<W: HasRawWindowHandle>(self, parent: &W) -> Self
Sets the parent window of the dialog.
sourceimpl FileDialogBuilder
impl FileDialogBuilder
sourcepub fn pick_file(self) -> Option<PathBuf>
pub fn pick_file(self) -> Option<PathBuf>
Shows the dialog to select a single file. This is a blocking operation, and should NOT be used when running on the main thread context.
Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
fn my_command() {
let file_path = FileDialogBuilder::new().pick_file();
// do something with the optional file path here
// the file path is `None` if the user closed the dialog
}
sourcepub fn pick_files(self) -> Option<Vec<PathBuf>>
pub fn pick_files(self) -> Option<Vec<PathBuf>>
Shows the dialog to select multiple files. This is a blocking operation, and should NOT be used when running on the main thread context.
Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
fn my_command() {
let file_path = FileDialogBuilder::new().pick_files();
// do something with the optional file paths here
// the file paths value is `None` if the user closed the dialog
}
sourcepub fn pick_folder(self) -> Option<PathBuf>
pub fn pick_folder(self) -> Option<PathBuf>
Shows the dialog to select a single folder. This is a blocking operation, and should NOT be used when running on the main thread context.
Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
fn my_command() {
let folder_path = FileDialogBuilder::new().pick_folder();
// do something with the optional folder path here
// the folder path is `None` if the user closed the dialog
}
sourcepub fn pick_folders(self) -> Option<Vec<PathBuf>>
pub fn pick_folders(self) -> Option<Vec<PathBuf>>
Shows the dialog to select multiple folders. This is a blocking operation, and should NOT be used when running on the main thread context.
Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
fn my_command() {
let folder_paths = FileDialogBuilder::new().pick_folders();
// do something with the optional folder paths here
// the folder paths value is `None` if the user closed the dialog
}
sourcepub fn save_file(self) -> Option<PathBuf>
pub fn save_file(self) -> Option<PathBuf>
Shows the dialog to save a file. This is a blocking operation, and should NOT be used when running on the main thread context.
Examples
use tauri::api::dialog::blocking::FileDialogBuilder;
#[tauri::command]
fn my_command() {
let file_path = FileDialogBuilder::new().save_file();
// do something with the optional file path here
// the file path is `None` if the user closed the dialog
}
Trait Implementations
sourceimpl Debug for FileDialogBuilder
impl Debug for FileDialogBuilder
sourceimpl Default for FileDialogBuilder
impl Default for FileDialogBuilder
sourcefn default() -> FileDialogBuilder
fn default() -> FileDialogBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for FileDialogBuilder
impl Send for FileDialogBuilder
impl !Sync for FileDialogBuilder
impl Unpin for FileDialogBuilder
impl UnwindSafe for FileDialogBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more