[][src]Struct transmission::TorrentBuilder

pub struct TorrentBuilder { /* fields omitted */ }

Used to create a new torrent in a builder pattern.

use transmission::Torrent;
use transmission::TorrentBuilder;

let file_to_build_from = String::from("./Cargo.toml");
let tracker_url = String::from("udp://tracker.opentrackr.org:1337");

let path = TorrentBuilder::new()
    .set_file(&file_to_build_from)
    .unwrap()
    .add_tracker(&tracker_url)
    .set_comment("Test torrent")
    .build()
    .expect("Failed to build torrent");

Methods

impl TorrentBuilder[src]

pub fn new() -> Self[src]

Create a new blank TorrentBuilder

pub fn build(self) -> TrResult<String>[src]

Consume the builder and return the created torrent or an error

pub fn set_file(self, file: &str) -> Result<Self>[src]

Set the file or folder the torrent is serving.

Takes the path to the file which must exist.

pub fn set_output_file(self, file: &str) -> Self[src]

Set's the full path of to the .torrent file that will be created.

pub fn add_tracker(self, tracker: &str) -> Self[src]

Add a tracker to the torrent

pub fn set_trackers(self, trackers: Vec<&str>) -> Self[src]

Set all the trackers on the torrent, replacing existing.

pub fn set_comment(self, comment: &str) -> Self[src]

Set the comment of the torrent

pub fn add_webseed(self, webseed: &str) -> Self[src]

Add a webseed to the torrent

pub fn set_webseeds(self, webseeds: Vec<&str>) -> Self[src]

Set all the webseeds on the torrent, replacing existing.

Trait Implementations

impl Default for TorrentBuilder[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.