[][src]Struct transmission_rs::client::Client

pub struct Client { /* fields omitted */ }

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();

Implementations

impl Client[src]

pub fn new(
    host: impl ToString,
    port: u16,
    tls: bool,
    auth: Option<(String, String)>
) -> Result<Self, Box<dyn Error>>
[src]

pub async fn authenticate<'_>(&'_ mut self) -> Result<(), Box<dyn Error>>[src]

pub fn post(&self, path: impl AsRef<str>) -> RequestBuilder[src]

pub async fn rpc<'_>(
    &'_ self,
    method: impl ToString,
    tag: u8,
    body: impl Serialize
) -> Result<Response, Box<dyn Error>>
[src]

pub async fn list<'_>(&'_ self) -> Result<Vec<Torrent>, Box<dyn Error>>[src]

Trait Implementations

impl Clone for Client[src]

Auto Trait Implementations

impl !RefUnwindSafe for Client

impl Send for Client

impl Sync for Client

impl Unpin for Client

impl !UnwindSafe for Client

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.