pub enum TorrentMeta {
V1(TorrentMetaV1),
V2(TorrentMetaV2),
Hybrid(Box<TorrentMetaV1>, Box<TorrentMetaV2>),
}Expand description
A parsed torrent file — v1, v2, or hybrid.
Variants§
V1(TorrentMetaV1)
BitTorrent v1 (BEP 3).
V2(TorrentMetaV2)
BitTorrent v2 (BEP 52).
Hybrid(Box<TorrentMetaV1>, Box<TorrentMetaV2>)
Hybrid v1+v2 (BEP 52). Contains both metadata representations. Boxed to avoid inflating the enum size for the common V1/V2 cases.
Implementations§
Source§impl TorrentMeta
impl TorrentMeta
Sourcepub fn info_hashes(&self) -> InfoHashes
pub fn info_hashes(&self) -> InfoHashes
Get the unified info hashes.
Sourcepub fn version(&self) -> TorrentVersion
pub fn version(&self) -> TorrentVersion
Get the protocol version enum.
Sourcepub fn as_v1(&self) -> Option<&TorrentMetaV1>
pub fn as_v1(&self) -> Option<&TorrentMetaV1>
Access the v1 metadata, if present (V1 or Hybrid).
Sourcepub fn as_v2(&self) -> Option<&TorrentMetaV2>
pub fn as_v2(&self) -> Option<&TorrentMetaV2>
Access the v2 metadata, if present (V2 or Hybrid).
Sourcepub fn best_v1_info_hash(&self) -> Id20
pub fn best_v1_info_hash(&self) -> Id20
Get the best v1-compatible info hash for session identification.
For v1 and hybrid: returns the v1 SHA-1 info hash. For v2-only: returns the v2 SHA-256 hash truncated to 20 bytes.
Trait Implementations§
Source§impl Clone for TorrentMeta
impl Clone for TorrentMeta
Source§fn clone(&self) -> TorrentMeta
fn clone(&self) -> TorrentMeta
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 TorrentMeta
impl Debug for TorrentMeta
Source§impl From<TorrentMetaV1> for TorrentMeta
impl From<TorrentMetaV1> for TorrentMeta
Source§fn from(meta: TorrentMetaV1) -> TorrentMeta
fn from(meta: TorrentMetaV1) -> TorrentMeta
Converts to this type from the input type.
Source§impl From<TorrentMetaV2> for TorrentMeta
impl From<TorrentMetaV2> for TorrentMeta
Source§fn from(meta: TorrentMetaV2) -> TorrentMeta
fn from(meta: TorrentMetaV2) -> TorrentMeta
Converts to this type from the input type.
Auto Trait Implementations§
impl !Freeze for TorrentMeta
impl RefUnwindSafe for TorrentMeta
impl Send for TorrentMeta
impl Sync for TorrentMeta
impl Unpin for TorrentMeta
impl UnsafeUnpin for TorrentMeta
impl UnwindSafe for TorrentMeta
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