pub trait FilePicker: Send + Sync {
// Required methods
fn pick(&self, request: PickRequest) -> Receiver<PortalOutcome>;
fn pick_multiple(&self, request: PickRequest) -> Receiver<MultiOutcome>;
fn launch(&self, request: LaunchRequest) -> Receiver<LaunchOutcome>;
// Provided methods
fn open_handle(&self, request: PickRequest) -> Receiver<OpenFileOutcome> { ... }
fn reopen(&self, reference: &Path, write: bool) -> Receiver<OpenFileOutcome> { ... }
fn save_file(&self, request: PickRequest) -> Receiver<OpenFileOutcome> { ... }
fn save_destination(&self, request: PickRequest) -> DestinationChannel { ... }
fn save_contents(
&self,
request: PickRequest,
bytes: Vec<u8>,
) -> Receiver<SaveOutcome> { ... }
}Required Methods§
Sourcefn pick(&self, request: PickRequest) -> Receiver<PortalOutcome>
fn pick(&self, request: PickRequest) -> Receiver<PortalOutcome>
Ask the person for a file and answer it by reference: what names it again, and what is handed on when it is opened.
fn pick_multiple(&self, request: PickRequest) -> Receiver<MultiOutcome>
fn launch(&self, request: LaunchRequest) -> Receiver<LaunchOutcome>
Provided Methods§
Sourcefn open_handle(&self, request: PickRequest) -> Receiver<OpenFileOutcome>
fn open_handle(&self, request: PickRequest) -> Receiver<OpenFileOutcome>
Ask the person for a file or folder and answer it already open, with what names it again
(portal::ChosenHandle): for a file an app reads in place, or a folder it walks. This
is the one answer a chooser gives an app: a native host hands a descriptor it opened with
the person’s rights, and a page hands the bytes it read. A chooser that only picks paths
answers none.
Sourcefn reopen(&self, reference: &Path, write: bool) -> Receiver<OpenFileOutcome>
fn reopen(&self, reference: &Path, write: bool) -> Receiver<OpenFileOutcome>
Open a file or folder again by the reference a choice answered
(portal::ChosenHandle::reference): a window restored on what it showed, or a file
inside a folder the person chose. Only a reference this app was given is reached; a host
that cannot name a choice again answers none.
fn save_file(&self, request: PickRequest) -> Receiver<OpenFileOutcome>
fn save_destination(&self, request: PickRequest) -> DestinationChannel
fn save_contents( &self, request: PickRequest, bytes: Vec<u8>, ) -> Receiver<SaveOutcome>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".