[−][src]Struct transmission::torrentbuilder::TorrentBuilder
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]
fn default() -> TorrentBuilder
[src]
Auto Trait Implementations
impl Send for TorrentBuilder
impl Sync for TorrentBuilder
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>,