| Crates.io | lt-rs |
| lib.rs | lt-rs |
| version | 0.1.3 |
| created_at | 2025-12-02 03:43:38.723678+00 |
| updated_at | 2025-12-23 16:02:11.310005+00 |
| description | Safe Libtorrent bindings for rust |
| homepage | |
| repository | https://github.com/pliduino/lt-rs |
| max_upload_size | |
| id | 1961106 |
| size | 13,664,723 |
Besides session being renamed to LtSession there's not much change on how to use it. Refer to https://www.libtorrent.org/tutorial-ref.html for tutorials.
This crate requires boost and b2 (boost-build) to compile libtorrent.
Basic example of adding a torrent:
use lt_rs::session::LtSession;
use lt_rs::add_torrent_params::AddTorrentParams;
use lt_rs::alert::{Alert, TorrentFinishedAlert};
fn main() {
let args = std::env::args().collect();
if args.len() <= 1 {
return; // No arguments provided
}
let mut session = LtSession::new();
let atp = AddTorrentParams::parse_magnet_uri(args[1]);
atp.set_path("./downloads");
session.add_torrent(atp);
loop {
session.pop_alerts();
for alert in &session.alerts() {
match alert {
Alert::TorrentAlert(alert) => match alert {
TorrentAlert::TorrentFinished(alert) => {
return;
},
_ => (),
}
_ => (),
}
}
}
}