1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! tur-rs: A relentless, high-concurrency download manager.
//!
//! `tur-rs` is a reusable download core with adaptive work-stealing,
//! protocol-aware scheduling, and platform-optimized storage backends.
//!
//! # Quick start (library embedding)
//!
//! ```rust,no_run
//! use tokio::task::LocalSet;
//! use tur_rs::{TurService, ServiceConfig, DownloadRequest, DownloadUpdate};
//!
//! # async fn example() -> anyhow::Result<()> {
//! let local = LocalSet::new();
//! local.run_until(async {
//! let mut service = TurService::new(ServiceConfig::default()).await?;
//!
//! let mut handle = service
//! .add_download(DownloadRequest::new("https://example.com/file.zip"))
//! .await?;
//!
//! while let Some(update) = handle.recv().await {
//! match update {
//! DownloadUpdate::Progress { downloaded_bytes, speed_bps } => {
//! println!("{downloaded_bytes} bytes at {speed_bps:.0} bps");
//! }
//! DownloadUpdate::TotalSize(size) => {
//! println!("Total: {size} bytes");
//! }
//! DownloadUpdate::Workers(workers) => {
//! println!("{} worker snapshots", workers.len());
//! }
//! DownloadUpdate::Protocol(protocol) => {
//! println!("Protocol: {protocol:?}");
//! }
//! DownloadUpdate::StatusChanged(status) => {
//! println!("Status: {status:?}");
//! if matches!(status, tur_rs::DownloadStatus::Completed) {
//! break;
//! }
//! }
//! }
//! }
//!
//! service.shutdown().await;
//! Ok::<_, anyhow::Error>(())
//! }).await
//! # }
//! ```
//!
//! See `examples/embed.rs` for a complete runnable example.
//!
//! # Features
//!
//! | Feature | Description |
//! |-------------------------------|--------------------------------------------------------------|
//! | `tui` (default) | Terminal UI via ratatui/crossterm |
//! | `http3` | Experimental HTTP/3 via QUIC (quinn, h3, rustls) |
//! | `linux-io-uring-experimental` | Experimental Linux io_uring storage backend |
//!
//! # Stability
//!
//! The types re-exported from this crate root (`TurService`, `ServiceConfig`,
//! `DownloadRequest`, `DownloadHandle`, `DownloadUpdate`, `DownloadStatus`,
//! `HttpMode`, `ScheduleMode`, `StorageConfig`) are the **stable public API**
//! and follow semantic versioning.
//!
//! Internal modules (`engine`, `connector`, `quic`, `storage`, `cli`) are
//! exposed for advanced use but may change between minor releases. Prefer
//! the re-exported types where possible.
// ---------------------------------------------------------------------------
// Public modules (exposed for the binary frontends and advanced embedding)
// ---------------------------------------------------------------------------
/// Stable service facade for frontend integration.
// ---------------------------------------------------------------------------
// Re-exports — stable public API surface
//
// These are the types that downstream consumers should rely on.
// Everything behind `engine::`, `connector::`, `quic::`, `storage::` is
// internal and subject to change.
// ---------------------------------------------------------------------------
pub use ;
pub use StorageConfig;
pub use ;