Struct rdest::Session[][src]

pub struct Session { /* fields omitted */ }

Session manager.

Implementations

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 Send for Session

impl Sync for Session

impl Unpin for Session

impl !UnwindSafe for Session

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> Instrument for T[src]

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

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.