pub struct OpenDialog { /* private fields */ }Expand description
The system’s dialog for choosing a file to open.
It blocks until answered and has to run on the UI thread, which is where
event handlers such as on_click run.
use ravenrs_platform_native::OpenDialog;
let chosen = OpenDialog::new().title("Abrir").filter("Texto", &["txt"]).ask();
if let Some(path) = chosen {
let text = std::fs::read_to_string(path)?;
}Implementations§
Source§impl OpenDialog
impl OpenDialog
Sourcepub fn new() -> OpenDialog
pub fn new() -> OpenDialog
A dialog that shows every file, until a filter narrows it.
Sourcepub fn title(self, title: &str) -> OpenDialog
pub fn title(self, title: &str) -> OpenDialog
Sets the dialog’s title.
Sourcepub fn filter(self, name: &str, extensions: &[&str]) -> OpenDialog
pub fn filter(self, name: &str, extensions: &[&str]) -> OpenDialog
Offers a kind of file, such as ("PDF", &["pdf"]).
Sourcepub fn folder(self, folder: &Path) -> OpenDialog
pub fn folder(self, folder: &Path) -> OpenDialog
Opens in this folder, when the system allows it.
Trait Implementations§
Source§impl Debug for OpenDialog
impl Debug for OpenDialog
Source§impl Default for OpenDialog
impl Default for OpenDialog
Source§fn default() -> OpenDialog
fn default() -> OpenDialog
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for OpenDialog
impl RefUnwindSafe for OpenDialog
impl Send for OpenDialog
impl Sync for OpenDialog
impl Unpin for OpenDialog
impl UnsafeUnpin for OpenDialog
impl UnwindSafe for OpenDialog
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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