pub struct SaveDialog { /* private fields */ }Expand description
The system’s dialog for choosing where to save a file. It asks before replacing a file that exists, so the path it returns can be written.
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::SaveDialog;
let chosen = SaveDialog::new("Contas.pdf").title("Exportar").filter("PDF", &["pdf"]).ask();
if let Some(path) = chosen {
std::fs::write(path, b"...")?;
}Implementations§
Source§impl SaveDialog
impl SaveDialog
Sourcepub fn new(file_name: &str) -> SaveDialog
pub fn new(file_name: &str) -> SaveDialog
A dialog suggesting this file name.
Sourcepub fn title(self, title: &str) -> SaveDialog
pub fn title(self, title: &str) -> SaveDialog
Sets the dialog’s title.
Sourcepub fn filter(self, name: &str, extensions: &[&str]) -> SaveDialog
pub fn filter(self, name: &str, extensions: &[&str]) -> SaveDialog
Offers a kind of file, such as ("PDF", &["pdf"]).
Sourcepub fn folder(self, folder: &Path) -> SaveDialog
pub fn folder(self, folder: &Path) -> SaveDialog
Opens in this folder, when the system allows it.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SaveDialog
impl RefUnwindSafe for SaveDialog
impl Send for SaveDialog
impl Sync for SaveDialog
impl Unpin for SaveDialog
impl UnsafeUnpin for SaveDialog
impl UnwindSafe for SaveDialog
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