Update docs, cleanup for 4.0.0 release

This commit is contained in:
Igor Katson 2023-12-03 12:14:50 +00:00
parent 3160f06f65
commit 006d83d6a7
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
29 changed files with 206 additions and 116 deletions

View file

@ -4,12 +4,14 @@ use anyhow::Context;
use crate::id20::Id20;
/// A parsed magnet link.
pub struct Magnet {
pub info_hash: Id20,
pub trackers: Vec<String>,
}
impl Magnet {
/// Parse a magnet link.
pub fn parse(url: &str) -> anyhow::Result<Magnet> {
let url = url::Url::parse(url).context("magnet link must be a valid URL")?;
if url.scheme() != "magnet" {