Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.29 KB | None | 0 0
  1. pub trait HashBuilder<T> {
  2. fn build(key: T) -> usize;
  3. }
  4.  
  5. impl HashBuilder<usize> for usize {
  6. fn build(key: usize) -> usize {
  7. key % 10
  8. }
  9. }
  10.  
  11. impl HashBuilder<String> for String {
  12. fn build(key: String) -> usize {
  13. return 24 as usize; // neglect the return here, it's just a dummy code
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement