Skip to main content

FilePicker

Trait FilePicker 

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

Source

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.

Source

fn pick_multiple(&self, request: PickRequest) -> Receiver<MultiOutcome>

Source

fn launch(&self, request: LaunchRequest) -> Receiver<LaunchOutcome>

Provided Methods§

Source

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.

Source

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.

Source

fn save_file(&self, request: PickRequest) -> Receiver<OpenFileOutcome>

Source

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

Source

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

Implementors§