Expand description
§rtorrent-xmlrpc-bindings
rtorrent-xmlrpc-bindings provides strongly-typed Rust bindings for the rtorrent XMLRPC API.
The XMLRPC API allows a high degree of introspection and control over an rtorrent instance.
§Usage
The top-level structure representing an rtorrent instance is Server. All errors produced by
the crate are encapsulated by the Error type.
use rtorrent_xmlrpc_bindings as rtorrent;
let my_handle = rtorrent::Server::new("http://1.2.3.4/RPC2");
println!("Hostname: {}", my_handle.hostname()?);
for download in my_handle.download_list()? {
println!("Download: {}", download.name()?);
}It can be more efficient to query multiple items at a time. Rtorrent’s XMLRPC API exposes an
interface for this called “multicalls.” In this crate, they are available through the
multicall submodule.
The following example queries the name and ratio of every torrent in rtorrent’s “default” view and prints the results.
use rtorrent_xmlrpc_bindings as rtorrent;
use rtorrent::multicall::d;
let my_handle = rtorrent::Server::new("http://1.2.3.4/RPC2");
d::MultiBuilder::new(&my_handle, "default")
.call(d::NAME)
.call(d::RATIO)
.invoke()?
.iter()
.for_each(|(name, ratio)| {
println!("{}: ratio: {}", name, ratio);
});§Current Limitations
- Some XMLRPC APIs are not yet wrapped by this crate.
!
Modules§
- multicall
- Rtorrent multicalls
Structs§
- Download
Downloadrepresents a loaded torrent- File
- A single
Fileassociated with aDownload - Peer
- A
Peerassociated with aDownload - Server
Serverrepresents a logical rtorrent instance- Tracker
- A
Trackerassociated with aDownload
Enums§
- Error
- The unified error type for this crate.
Traits§
- TryFrom
Value - Essentially TryFrom
with crate::Error, but we need our own trait because crates are not allowed to define implementations of traits from foreign crates on types from forein crates.