Skip to main content

FilePicker

Trait FilePicker 

Source
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§

Source

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.

Source

fn pick_multiple(&self, request: PickRequest) -> MultiChannel

Source

fn launch(&self, request: LaunchRequest) -> LaunchChannel

Provided Methods§

Source

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.

Source

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.

Source

fn save_file(&self, request: PickRequest) -> OpenFileChannel

Source

fn save_destination(&self, request: PickRequest) -> DestinationChannel

Source

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".

Implementors§