Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use std::hash::Hash and std::hash::Hasher interfaces #2

Closed
eddiew opened this issue Jan 22, 2019 · 2 comments
Closed

Use std::hash::Hash and std::hash::Hasher interfaces #2

eddiew opened this issue Jan 22, 2019 · 2 comments
Assignees

Comments

@eddiew
Copy link
Collaborator

eddiew commented Jan 22, 2019

This enables us to write

#[deriving (Hash)]
struct X { ... }

to get hash(&self, hasher: &mut H)
instead of manually defining how to feed values into the hasher.

As part of this we'll be able to define hashes without having to go through the indirection of serialization, which is nice

I'll handle this myself over the next few days, but feedback is welcome

@eddiew
Copy link
Collaborator Author

eddiew commented Jan 23, 2019

Hasher is restricted to u64 output, so maybe we can't do this...
See rust-lang/rfcs#1768

@eddiew
Copy link
Collaborator Author

eddiew commented Jan 23, 2019

We extended Hasher to GeneralHasher to solve this.

@eddiew eddiew closed this as completed Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants