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)
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);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
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FileDialog
impl RefUnwindSafe for FileDialog
impl Send for FileDialog
impl Sync for FileDialog
impl Unpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.