pub struct TorrentInfo {
pub name: String,
pub pieces: Option<ByteBuf>,
pub piece_length: i64,
pub md5sum: Option<String>,
pub length: Option<i64>,
pub files: Option<Vec<TorrentFile>>,
pub private: Option<u8>,
pub path: Option<Vec<String>>,
pub root_hash: Option<String>,
}
Fields§
§name: String
§pieces: Option<ByteBuf>
§piece_length: i64
§md5sum: Option<String>
§length: Option<i64>
§files: Option<Vec<TorrentFile>>
§private: Option<u8>
§path: Option<Vec<String>>
§root_hash: Option<String>
Implementations§
Source§impl TorrentInfo
impl TorrentInfo
Sourcepub fn get_pieces_as_string(&self) -> String
pub fn get_pieces_as_string(&self) -> String
torrent file can only hold a pieces key or a root hash key: BEP 39
Sourcepub fn get_root_hash_as_i64(&self) -> i64
pub fn get_root_hash_as_i64(&self) -> i64
It returns the root hash as a i64
value.
§Panics
This function will panic if the root hash cannot be converted into a
i64
value.
pub fn is_a_single_file_torrent(&self) -> bool
pub fn is_a_multiple_file_torrent(&self) -> bool
Trait Implementations§
Source§impl Clone for TorrentInfo
impl Clone for TorrentInfo
Source§fn clone(&self) -> TorrentInfo
fn clone(&self) -> TorrentInfo
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for TorrentInfo
impl Debug for TorrentInfo
Source§impl<'de> Deserialize<'de> for TorrentInfo
impl<'de> Deserialize<'de> for TorrentInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for TorrentInfo
impl PartialEq for TorrentInfo
Source§impl Serialize for TorrentInfo
impl Serialize for TorrentInfo
impl Eq for TorrentInfo
impl StructuralPartialEq for TorrentInfo
Auto Trait Implementations§
impl Freeze for TorrentInfo
impl RefUnwindSafe for TorrentInfo
impl Send for TorrentInfo
impl Sync for TorrentInfo
impl Unpin for TorrentInfo
impl UnwindSafe for TorrentInfo
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more