Struct rdest::Session [−][src]
pub struct Session { /* fields omitted */ }
Session manager.
Implementations
impl Session
[src]
impl Session
[src]pub fn new(metainfo: Metainfo, own_id: [u8; 20]) -> Session
[src]
Create new instance managing peer-to-peer connection. Currently most settings, are set as constatns.
Example
use rdest::{Metainfo, Session}; use std::path::PathBuf; let path = PathBuf::from("ubuntu-20.04.2.0-desktop-amd64.iso.torrent"); let torrent_file = Metainfo::from_file(path.as_path()).unwrap(); let peer_id = b"AAAAABBBBBCCCCCDDDDD"; let mut session = Session::new(torrent_file, *peer_id);
pub async fn run(&mut self)
[src]
Run Session that will try connect to tracker, get list of available peers, and establish connection with them
Example
use rdest::{Metainfo, Session}; use std::path::Path; let path = Path::new("ubuntu-20.04.2.0-desktop-amd64.iso.torrent"); let torrent_file = Metainfo::from_file(path).unwrap(); let peer_id = b"AAAAABBBBBCCCCCDDDDD"; let mut session = Session::new(torrent_file, *peer_id); session.run().await;
Auto Trait Implementations
impl !RefUnwindSafe for Session
impl !RefUnwindSafe for Session
impl !UnwindSafe for Session
impl !UnwindSafe for Session
Blanket Implementations
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]