Skip to main content

FilePickerProvider

Trait FilePickerProvider 

Source
pub trait FilePickerProvider {
    // Required method
    fn pick(
        &self,
        request: &FileRequest,
        done: Box<dyn FnOnce(Vec<PickedFile>)>,
    );

    // Provided method
    fn save(&self, _name: &str, _bytes: &[u8]) { ... }
}
Expand description

Asks the person for files. Platform layers install one with crate::Ui::set_file_picker.

Required Methods§

Source

fn pick(&self, request: &FileRequest, done: Box<dyn FnOnce(Vec<PickedFile>)>)

Shows the system’s chooser, and calls done with what was chosen, now or later on the UI thread. Canceling gives an empty list.

Provided Methods§

Source

fn save(&self, _name: &str, _bytes: &[u8])

Hands a file over to the person: the system’s dialog on a desktop, a download in a browser. Nothing happens where there is no system to ask.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§