Struct Magnet

Source
pub struct Magnet {
    pub dn: Option<String>,
    pub hash_type: Option<String>,
    pub xt: Option<String>,
    pub xl: Option<u64>,
    pub xs: Option<String>,
    pub tr: Vec<String>,
    pub kt: Option<String>,
    pub ws: Option<String>,
    pub acceptable_source: Option<String>,
    pub mt: Option<String>,
}

Fields§

§dn: Option<String>

Display Name of the torrent

§hash_type: Option<String>

type of hash used in the exact topic

§xt: Option<String>

eXact Topic: URN containing the file hash. The URN is specific to the protocol so a file hash URN under btih (BitTorrent) would be completely different than the file hash URN for ed2k

§xl: Option<u64>

eXact Length: The size (in bytes)

§xs: Option<String>

eXact Source: Either an HTTP (or HTTPS, FTP, FTPS, etc.) download source for the file pointed to by the Magnet link, the address of a P2P source for the file or the address of a hub (in the case of DC++), by which a client tries to connect directly, asking for the file and/or its sources. This field is commonly used by P2P clients to store the source, and may include the file hash.

§tr: Vec<String>

address TRacker: Tracker URL; used to obtain resources for BitTorrent downloads without a need for DHT support. The value must be URL encoded

§kt: Option<String>

Keyword Topic: Specifies a string of search keywords to search for in P2P networks, rather than a particular file. Also set as a vector since there will likely be more than one

§ws: Option<String>

Web Seed: The payload data served over HTTP(S)

§acceptable_source: Option<String>

Acceptable Source: Refers to a direct download from a web server. Regarded as only a fall-back source in case a client is unable to locate and/or download the linked-to file in its supported P2P network(s) as is a reserved keyword in Rust, so unfortunately this library must use the full name

§mt: Option<String>

Manifest Topic: Link to the metafile that contains a list of magneto (MAGMA – MAGnet MAnifest); i.e. a link to a list of links

Implementations§

Source§

impl Magnet

Source

pub fn new_no_validation(magnet_str: &str) -> Magnet

Given a magnet URL, identify the specific parts, and return the Magnet struct. If the program can’t identify a specific part of the magnet, then it will either give an empty version of what its value would normally be (such as an empty string, an empty vector, or in the case of xl, -1). It also doesn’t validate whether the magnet url is good, which makes it faster, but dangerous! Only use this function if you know for certain that the magnet url given is valid.

Source

pub fn new(magnet_str: &str) -> Result<Magnet, MagnetError>

The recommended way of creating magnets. The same as new_no_validation, but does validation

Trait Implementations§

Source§

impl Clone for Magnet

Source§

fn clone(&self) -> Magnet

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Magnet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Magnet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Magnet

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Magnet

Source§

fn eq(&self, other: &Magnet) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Magnet

Auto Trait Implementations§

§

impl Freeze for Magnet

§

impl RefUnwindSafe for Magnet

§

impl Send for Magnet

§

impl Sync for Magnet

§

impl Unpin for Magnet

§

impl UnwindSafe for Magnet

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.