pub trait FilePicker: Send + Sync {
// Required methods
fn pick(&self, request: PickRequest) -> PortalChannel;
fn pick_multiple(&self, request: PickRequest) -> MultiChannel;
fn launch(&self, request: LaunchRequest) -> LaunchChannel;
// Provided methods
fn open_handle(&self, request: PickRequest) -> OpenFileChannel { ... }
fn reopen(&self, reference: &Path, write: bool) -> OpenFileChannel { ... }
fn save_file(&self, request: PickRequest) -> OpenFileChannel { ... }
fn save_destination(&self, request: PickRequest) -> DestinationChannel { ... }
fn save_contents(&self, request: PickRequest, bytes: Vec<u8>) -> SaveChannel { ... }
}Required Methods§
Sourcefn pick(&self, request: PickRequest) -> PortalChannel
fn pick(&self, request: PickRequest) -> PortalChannel
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) -> MultiChannel
fn launch(&self, request: LaunchRequest) -> LaunchChannel
Provided Methods§
Sourcefn open_handle(&self, request: PickRequest) -> OpenFileChannel
fn open_handle(&self, request: PickRequest) -> OpenFileChannel
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) -> OpenFileChannel
fn reopen(&self, reference: &Path, write: bool) -> OpenFileChannel
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) -> OpenFileChannel
fn save_destination(&self, request: PickRequest) -> DestinationChannel
fn save_contents(&self, request: PickRequest, bytes: Vec<u8>) -> SaveChannel
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".