Skip to main content

fast_down_ffi/
lib.rs

1#![doc = include_str!("../README.md")]
2
3mod config;
4mod download;
5mod error;
6mod event;
7
8pub use config::*;
9pub use download::*;
10pub use error::*;
11pub use event::*;
12pub use fast_down;
13pub use fast_down::{
14    AnyError, BoxPusher, DownloadResult, Event as RawEvent, FileId, InvertIter, Merge,
15    ProgressEntry, Proxy, PullResult, PullStream, Puller, PullerError, Pusher, Total, UrlInfo,
16    WorkerId, fast_puller, getifaddrs, handle, http, invert, mock, multi,
17    reqwest as reqwest_adapter, single, unique_path,
18};
19
20#[cfg(feature = "file")]
21pub use fast_down::file;
22#[cfg(feature = "mem")]
23pub use fast_down::mem;
24
25use tokio_util::sync::CancellationToken;
26
27pub type Tx = crossfire::MTx<crossfire::spsc::List<Event>>;
28pub type Rx = crossfire::AsyncRx<crossfire::spsc::List<Event>>;
29
30#[must_use]
31pub fn create_channel() -> (Tx, Rx) {
32    crossfire::mpsc::unbounded_async()
33}
34
35#[must_use]
36pub fn create_cancellation_token() -> CancellationToken {
37    CancellationToken::new()
38}