pub struct Magnet { /* private fields */ }Expand description
Represents a parsed magnet URL with all its components
Implementations§
Source§impl Magnet
impl Magnet
Sourcepub fn new(magnet_str: &str) -> Result<Magnet, MagnetError>
pub fn new(magnet_str: &str) -> Result<Magnet, MagnetError>
Parse a magnet URL string into a Magnet struct
§Arguments
magnet_str- A string slice containing the magnet URL
§Returns
Result<Magnet, MagnetError>- A Result containing the parsed Magnet or an error
§Errors
Returns Err(MagnetError::NotAMagnetURL) if the string does not start with “magnet:?”
§Example
use magnet_url::Magnet;
let magnet = Magnet::new("magnet:?xt=urn:btih:08ada5a7a6183aae1e09d831df6748d566095a10&dn=Sintel").unwrap();Sourcepub fn display_name(&self) -> Option<&str>
pub fn display_name(&self) -> Option<&str>
Get the display name of the torrent
Sourcepub fn search_keywords(&self) -> Option<&str>
pub fn search_keywords(&self) -> Option<&str>
Get the search keywords
Sourcepub fn acceptable_source(&self) -> Option<&str>
pub fn acceptable_source(&self) -> Option<&str>
Get the acceptable source
Trait Implementations§
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 UnsafeUnpin for Magnet
impl UnwindSafe for Magnet
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