Skip to content

Commit

Permalink
adding some clarification about AsAtrHashEq
Browse files Browse the repository at this point in the history
  • Loading branch information
jakubDoka committed Jun 27, 2024
1 parent 9cfdfb5 commit 3f8eb31
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions swarm/src/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<str>` as a key in hashmap
pub(crate) struct AsStrHashEq<T>(pub(crate) T);

impl<T: AsRef<str>> Eq for AsStrHashEq<T> {}
Expand Down

0 comments on commit 3f8eb31

Please sign in to comment.