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

BinaryFuse filters only implement TryFrom, conflicting with HashProxy #72

Open
ghost opened this issue May 28, 2023 · 2 comments
Open

Comments

@ghost
Copy link

ghost commented May 28, 2023

Attempting to use a HashProxy<String, DefaultHasher, BinaryFuse8> is impossible in the current state due to HashProxy::from failing. You can reproduce by replacing Xor8 with BinaryFuse8 in the example.

Output from cargo:

error[E0277]: the trait bound `xorf::BinaryFuse8: std::convert::From<std::vec::Vec<u64>>` is not satisfied
  --> src\lib.rs:59:84
   |
59 |     let pw_filter: HashProxy<String, DefaultHasher, BinaryFuse8> = HashProxy::from(&passwords);
   |                                                                    --------------- ^^^^^^^^^^ the trait `std::convert::From<std::vec::Vec<u64>>` is not implemented for `xorf::BinaryFuse8`
   |                                                                    |
   |                                                                    required by a bound introduced by this call
   |
   = help: the following other types implement trait `std::convert::From<T>`:
             <xorf::HashProxy<T, H, F> as std::convert::From<&[T]>>
             <xorf::HashProxy<T, H, F> as std::convert::From<&std::vec::Vec<T>>>
   = note: required for `xorf::HashProxy<std::string::String, std::collections::hash_map::DefaultHasher, xorf::BinaryFuse8>` to implement `std::convert::From<&std::vec::Vec<std::string::String>>`
@ayazhafiz
Copy link
Owner

We should probably have HashProxy implement TryFrom in this case. Would that work for your use case?

@ghost
Copy link
Author

ghost commented Jun 2, 2023

I do believe it would, yes! For reference, I learned more and have since moved away from HashProxy for my use case, however, this would still be good for newcomers.

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

1 participant