Skip to main content

Module xftp

Module xftp 

Source
Available on crate feature xftp only.
Expand description

XFTP file download manager.

XftpClient wraps any ClientApi client and observes the file rcv events emitted by the SimpleX-Chat. DownloadFileBuilder (obtained via XftpExt::download_file) initiates the transfer and awaits those events, returning the outcome directly to the caller.

§When to use

  • Out-of-handler downloads. When the decision to download a file is made outside an event handler (for example, after a user command or a timer), download_file provides the result without requiring custom event routing.

  • Keeping download logic in one handler. Sometimes it may be useful to keep all logic in a single handler to simplify state management.

Structs§

DownloadFileBuilder
XftpClient
A ClientApi wrapper that intercepts file-result events and routes them to the corresponding DownloadFileBuilder futures. Should be constructed by EventStream::hook_xftp to work correctly.

Enums§

DownloadError
Error returned when a DownloadFileBuilder future resolves unsuccessfully.

Traits§

XftpExt
Adds download_file to any ClientApi. Automatically implemented for XftpClient.