Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. use std::net::TcpStream;
  2. use std::hash::{Hash, Hasher};
  3.  
  4. struct Connection {
  5. name: String,
  6. stream: TcpStream,
  7. }
  8.  
  9. impl Eq for Connection {}
  10. impl PartialEq for Connection {
  11. fn eq(&self, other: &Self) -> bool {
  12. self.name == other.name
  13. }
  14. }
  15. impl Hash for Connection {
  16. fn hash<H: Hasher>(&self, state: &mut H) {
  17. self.name.hash(state);
  18. }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement