From 3f8eb3102aef6269bc8bbd7e69e9fb3dc513cc51 Mon Sep 17 00:00:00 2001 From: Jakub Doka Date: Thu, 27 Jun 2024 11:56:00 +0200 Subject: [PATCH] adding some clarification about `AsAtrHashEq` --- swarm/src/connection.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/swarm/src/connection.rs b/swarm/src/connection.rs index a840ab75204..7738ecd0c87 100644 --- a/swarm/src/connection.rs +++ b/swarm/src/connection.rs @@ -745,6 +745,8 @@ enum Shutdown { Later(Delay), } +// Instead of allocating new string from `T::as_ref()` we wrap in in zero cost struct that +// allows us to use the `T: AsRef` as a key in hashmap pub(crate) struct AsStrHashEq(pub(crate) T); impl> Eq for AsStrHashEq {}