Struct bip_metainfo::Info
[−]
[src]
pub struct Info { /* fields omitted */ }
Contains directory and checksum data for a torrent file.
Methods
impl Info
[src]
fn from_bytes<B>(bytes: B) -> ParseResult<Info> where
B: AsRef<[u8]>,
B: AsRef<[u8]>,
Read an Info
from info dictionary bytes.
fn info_hash(&self) -> InfoHash
Hash to uniquely identify this torrent.
fn directory(&self) -> Option<&Path>
Some file directory if this is a multi-file torrent, otherwise None.
If you want to check to see if this is a multi-file torrent, you should check whether or not this returns Some. Checking the number of files present is NOT the correct method.
fn piece_length(&self) -> u64
Length in bytes of each piece.
fn is_private(&self) -> Option<bool>
Whether or not the torrent is private.
fn pieces<'a>(&'a self) -> Pieces<'a>
Iterator over each of the pieces SHA-1 hash.
Ordering of pieces yielded in the iterator is guaranteed to be the order in which they are found in the torrent file as this is necessary to refer to pieces by their index to other peers.
fn files<'a>(&'a self) -> Files<'a>
Iterator over each file within the torrent file.
Ordering of files yielded in the iterator is guaranteed to be the order in which they are found in the torrent file as this is necessary to reconstruct pieces received from peers.
fn to_bytes(&self) -> Vec<u8>
Retrieve the bencoded bytes for the Info
dictionary.
Trait Implementations
impl Debug for Info
[src]
impl Clone for Info
[src]
fn clone(&self) -> Info
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Eq for Info
[src]
impl PartialEq for Info
[src]
fn eq(&self, __arg_0: &Info) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Info) -> bool
This method tests for !=
.
impl IntoAccessor for Info
[src]
type Accessor = Info
Concrete Accessor type that will be converted into.
fn into_accessor(self) -> Result<Info>
Convert the type into some Accessor as a Result.
impl<'a> IntoAccessor for &'a Info
[src]
type Accessor = &'a Info
Concrete Accessor type that will be converted into.
fn into_accessor(self) -> Result<&'a Info>
Convert the type into some Accessor as a Result.
impl Accessor for Info
[src]
fn access_directory(&self) -> Option<&Path>
Access the directory that all files should be relative to.
fn access_metadata<C>(&self, callback: C) -> Result<()> where
C: FnMut(u64, &Path),
C: FnMut(u64, &Path),
Access the metadata for all files including their length and path.
fn access_pieces<C>(&self, callback: C) -> Result<()> where
C: for<'a> FnMut(PieceAccess<'a>) -> Result<()>,
C: for<'a> FnMut(PieceAccess<'a>) -> Result<()>,
Access the sequential pieces that make up all of the files.