[−][src]Struct transmission::client::Client
Interface into the major functions of Transmission including adding, and removing torrents.
The Client
does not keep track of the created torrents itself.
Example of creating a session and adding a torrent and waiting for it to complete.
use transmission::{ ClientConfig, Client}; let file_path = "./alpine.torrent"; let c = ClientConfig::new() .app_name("testing") .config_dir(config_dir) .download_dir(download_dir); let mut c = Client::new(c); let t = c.add_torrent_file(file_path).unwrap(); t.start(); // Run until done while t.stats().percent_complete < 1.0 { print!("{:#?}\r", t.stats().percent_complete); } c.close();
Methods
impl Client
[src]
pub fn new(config: ClientConfig) -> Self
[src]
Creates a new Client
and initializes the session.
Takes a ClientConfig
with the populated options.
pub fn add_torrent_file(&mut self, path: &str) -> TrResult<Torrent>
[src]
Adds a torrent using a torrent file.
Takes the path to the torrent file on the disk.
use transmission::{ ClientConfig, Client}; let file_path = "./alpine.torrent"; let c = ClientConfig::new() .app_name("testing") .config_dir(config_dir) .download_dir(download_dir); let mut c = Client::new(c); let t = c.add_torrent_file(file_path).unwrap(); c.close();
pub fn add_torrent_magnet(&mut self, link: &str) -> TrResult<Torrent>
[src]
Adds a torrent using a magnet link.
Takes the magnet URI of the torrent.
use transmission::{ ClientConfig, Client}; let c = ClientConfig::new() .app_name("testing") .config_dir(config_dir) .download_dir(download_dir); let mut c = Client::new(c); let t = c.add_torrent_magnet(magnet_uri).unwrap(); c.close();
pub fn close(&mut self)
[src]
Gracefully closes the client ending the session.
Always call this otherwise the client will panic!
on drop in order to prevent issues.
Trait Implementations
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
🔬 This is a nightly-only experimental API. (
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,