pub trait FilePicker {
// Required methods
fn pick_file(
&self,
options: FilePickerOptions,
) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn Content>>, FilePickerError>>>>;
fn pick_folder(
&self,
options: FilePickerOptions,
) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn ContentFolder>>, FilePickerError>>>>;
// Provided methods
fn pick_files(
&self,
options: FilePickerOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<Rc<dyn Content>>, FilePickerError>>>> { ... }
fn save_document(
&self,
request: SaveDocumentRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn ContentSink>>, FilePickerError>>>> { ... }
fn pick_writable_folder(
&self,
options: FilePickerOptions,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, FilePickerError>>>> { ... }
}Expand description
Re-export framework services (HTTP, URI, etc.) from the dedicated services crate. Presents the system’s file, folder and document choosers.
Implemented by the platform backends and consumed by crate::launcher.
Required Methods§
Sourcefn pick_file(
&self,
options: FilePickerOptions,
) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn Content>>, FilePickerError>>>>
fn pick_file( &self, options: FilePickerOptions, ) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn Content>>, FilePickerError>>>>
Presents a single-file chooser. Resolves to None if cancelled.
Sourcefn pick_folder(
&self,
options: FilePickerOptions,
) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn ContentFolder>>, FilePickerError>>>>
fn pick_folder( &self, options: FilePickerOptions, ) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn ContentFolder>>, FilePickerError>>>>
Presents a folder chooser. Resolves to None if cancelled.
Provided Methods§
Sourcefn pick_files(
&self,
options: FilePickerOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<Rc<dyn Content>>, FilePickerError>>>>
fn pick_files( &self, options: FilePickerOptions, ) -> Pin<Box<dyn Future<Output = Result<Vec<Rc<dyn Content>>, FilePickerError>>>>
Presents a multi-file chooser. Resolves to an empty vector if cancelled.
The default presents the single-file chooser, for backends whose system chooser has no multi-selection mode.
Sourcefn save_document(
&self,
request: SaveDocumentRequest,
) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn ContentSink>>, FilePickerError>>>>
fn save_document( &self, request: SaveDocumentRequest, ) -> Pin<Box<dyn Future<Output = Result<Option<Rc<dyn ContentSink>>, FilePickerError>>>>
Presents a save-destination chooser and opens a sink on the chosen
document. Resolves to None if cancelled.
Sourcefn pick_writable_folder(
&self,
options: FilePickerOptions,
) -> Pin<Box<dyn Future<Output = Result<Option<String>, FilePickerError>>>>
fn pick_writable_folder( &self, options: FilePickerOptions, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, FilePickerError>>>>
Presents a chooser for a folder the app may keep writing to across runs,
resolving to the durable handle accepted by
crate::writable_folder::open_writable_folder.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".