diff --git a/crates/librqbit/src/http_api.rs b/crates/librqbit/src/http_api.rs index 79b8408..d79556d 100644 --- a/crates/librqbit/src/http_api.rs +++ b/crates/librqbit/src/http_api.rs @@ -90,7 +90,7 @@ impl Inner { .enumerate() .map(|(id, mgr)| TorrentListResponseItem { id, - info_hash: hex::encode(mgr.torrent_state().info_hash().0), + info_hash: mgr.torrent_state().info_hash().as_string(), }) .collect(), } @@ -98,7 +98,7 @@ impl Inner { fn api_torrent_details(&self, idx: usize) -> Option { let handle = self.mgr_handle(idx)?; - let info_hash = hex::encode(handle.torrent_state().info_hash().0); + let info_hash = handle.torrent_state().info_hash().as_string(); let files = handle .torrent_state() .info() diff --git a/crates/librqbit_core/src/id20.rs b/crates/librqbit_core/src/id20.rs index c1dc6eb..b234087 100644 --- a/crates/librqbit_core/src/id20.rs +++ b/crates/librqbit_core/src/id20.rs @@ -67,7 +67,7 @@ impl<'de> Deserialize<'de> for Id20 { } impl Id20 { - pub fn to_string(&self) -> String { + pub fn as_string(&self) -> String { hex::encode(self.0) } pub fn distance(&self, other: &Id20) -> Id20 { diff --git a/crates/librqbit_core/src/torrent_metainfo.rs b/crates/librqbit_core/src/torrent_metainfo.rs index afc60a6..a3e5cbe 100644 --- a/crates/librqbit_core/src/torrent_metainfo.rs +++ b/crates/librqbit_core/src/torrent_metainfo.rs @@ -297,7 +297,7 @@ mod tests { let torrent: TorrentMetaV1Borrowed = torrent_from_bytes(&buf).unwrap(); assert_eq!( - torrent.info_hash.to_string(), + torrent.info_hash.as_string(), "64a980abe6e448226bb930ba061592e44c3781a1" ); }