1#![warn(clippy::cast_possible_truncation)]
27
28macro_rules! aframe {
29 ($e:expr) => {{
30 #[cfg(feature = "async-bt")]
31 {
32 async_backtrace::frame!($e)
33 }
34 #[cfg(not(feature = "async-bt"))]
35 {
36 $e
37 }
38 }};
39}
40
41pub mod api;
42mod api_error;
43mod bitv;
44mod bitv_factory;
45mod blocklist;
46mod chunk_tracker;
47mod create_torrent_file;
48mod dht_utils;
49pub mod file_info;
50mod file_ops;
51#[cfg(feature = "http-api")]
52pub mod http_api;
53#[cfg(feature = "http-api-client")]
54pub mod http_api_client;
55#[cfg(any(feature = "http-api", feature = "http-api-client"))]
56pub mod http_api_types;
57pub mod limits;
58mod merge_streams;
59mod peer_connection;
60mod peer_info_reader;
61mod read_buf;
62mod session;
63mod session_persistence;
64pub mod session_stats;
65mod spawn_utils;
66pub mod storage;
67mod stream_connect;
68mod torrent_state;
69#[cfg(feature = "tracing-subscriber-utils")]
70pub mod tracing_subscriber_config_utils;
71mod type_aliases;
72#[cfg(all(feature = "http-api", feature = "upnp-serve-adapter"))]
73pub mod upnp_server_adapter;
74#[cfg(feature = "watch")]
75pub mod watch;
76
77pub use api::Api;
78pub use api_error::ApiError;
79pub use create_torrent_file::{create_torrent, CreateTorrentOptions};
80pub use dht;
81pub use peer_connection::PeerConnectionOptions;
82pub use session::{
83 AddTorrent, AddTorrentOptions, AddTorrentResponse, ListOnlyResponse, Session, SessionOptions,
84 SessionPersistenceConfig, SUPPORTED_SCHEMES,
85};
86pub use spawn_utils::spawn as librqbit_spawn;
87pub use torrent_state::{
88 ManagedTorrent, ManagedTorrentShared, ManagedTorrentState, TorrentMetadata, TorrentStats,
89 TorrentStatsState,
90};
91pub use type_aliases::FileInfos;
92
93pub use buffers::*;
94pub use clone_to_owned::CloneToOwned;
95pub use librqbit_core::magnet::*;
96pub use librqbit_core::peer_id::*;
97pub use librqbit_core::torrent_metainfo::*;
98
99#[cfg(test)]
100mod tests;
101
102pub const fn version() -> &'static str {
104 env!("CARGO_PKG_VERSION")
105}
106
107pub const fn client_name_and_version() -> &'static str {
108 concat!("rqbit ", env!("CARGO_PKG_VERSION"))
109}
110
111pub fn try_increase_nofile_limit() -> anyhow::Result<u64> {
112 Ok(rlimit::increase_nofile_limit(1024 * 1024)?)
113}