lt-rs

Crates.iolt-rs
lib.rslt-rs
version0.1.3
created_at2025-12-02 03:43:38.723678+00
updated_at2025-12-23 16:02:11.310005+00
descriptionSafe Libtorrent bindings for rust
homepage
repositoryhttps://github.com/pliduino/lt-rs
max_upload_size
id1961106
size13,664,723
Pedro Liduino (pliduino)

documentation

README

Lt-rs

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.

Examples

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;
                    },
                    _ => (),
                }
                _ => (),
            }
        }
    }
}
Commit count: 0

cargo fmt