Struct ashpd::documents::FileTransferProxy [−][src]
pub struct FileTransferProxy<'a>(_);
Expand description
The interface operates as a middle-man between apps when transferring files via drag-and-drop or copy-paste, taking care of the necessary exporting of files in the document portal.
Toolkits are expected to use the application/vnd.portal.filetransfer mimetype when using this mechanism for file exchange via copy-paste or drag-and-drop.
The data that is transmitted with this mimetype should be the key returned by the StartTransfer method. Upon receiving this mimetype, the target should call RetrieveFiles with the key, to obtain the list of files. The portal will take care of exporting files in the document store as necessary to make them accessible to the target.
Implementations
Create a new instance of FileTransferProxy
.
Adds files to a session. This method can be called multiple times on a given session. Note that only regular files (not directories) can be added.
Arguments
key
- A key returned byFileTransferProxy::start_transfer
.fds
- A list of file descriptors of the files to register.
Retrieves files that were previously added to the session with
add_files
. The files will be exported in the document portal
as-needed for the caller, and they will be writable if the owner of
the session allowed it.
Returns the list of file paths.
Arguments
key
- A key returned byFileTransferProxy::start_transfer
.
Starts a session for a file transfer.
The caller should call FileTransferProxy::add_files
at least once, to add files to this
session.
Arguments
writeable
- Sets whether the chosen application can write to the files or not.auto_stop
- Whether to stop the transfer automatically after the firstFileTransferProxy::retrieve_files
call.
Returns
a key that can be passed to FileTransferProxy::retrieve_files
to obtain the files.
Ends the transfer.
Further calls to FileTransferProxy::add_files
or FileTransferProxy::retrieve_files
for this key will
return an error.
Arguments
key
- A key returned byFileTransferProxy::start_transfer
.
Trait Implementations
Auto Trait Implementations
impl<'a> !RefUnwindSafe for FileTransferProxy<'a>
impl<'a> Send for FileTransferProxy<'a>
impl<'a> Sync for FileTransferProxy<'a>
impl<'a> Unpin for FileTransferProxy<'a>
impl<'a> !UnwindSafe for FileTransferProxy<'a>