Skip to content

Commit 210d4ec

Browse files
committed
feat: Tracker implements FromStr
1 parent 6c76499 commit 210d4ec

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
3030
- Added new `MagnetLinkError` variants to be more precise about what's wrong with
3131
a parsed magnet link.
3232
- `MagnetLink::trackers` lists the trackers in the magnet link
33-
- `TrackerScheme` implements `FromStr`
33+
- `TrackerScheme` and `Tracker` implement `FromStr`
3434

3535
### Fixed
3636

src/tracker.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ impl Serialize for Tracker {
7070
}
7171
}
7272

73+
impl FromStr for Tracker {
74+
type Err = TrackerError;
75+
76+
fn from_str(s: &str) -> Result<Self, Self::Err> {
77+
Self::new(s)
78+
}
79+
}
80+
7381
/// A protocol used by a [`Tracker`](crate::tracker::Tracker).
7482
///
7583
/// Does not implement Serialize/Deserialize because it's actually not in the

0 commit comments

Comments
 (0)