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

db_key::Key is not implemented for u64` #46

Open
xiuno opened this issue Dec 24, 2020 · 2 comments
Open

db_key::Key is not implemented for u64` #46

xiuno opened this issue Dec 24, 2020 · 2 comments

Comments

@xiuno
Copy link

xiuno commented Dec 24, 2020

I need the u64 as key, but this lib does not support, has the milestone ?

let k = 123u64;
let bytes: [u8; 8] = unsafe { std::mem::transmute(i) };
database.put(write_opts, i, &bytes);
@palkeo
Copy link

palkeo commented Jan 7, 2021

You can implement a Key type yourself, that implements the Key trait and does what you need, like this:
https://docs.rs/db-key/0.0.5/src/db_key/.cargo/registry/src/github.com-1ecc6299db9ec823/db-key-0.0.5/src/lib.rs.html#1-4

@xiuno
Copy link
Author

xiuno commented Feb 5, 2021

According to the orphan rule, I cannot implement the Key interface in db-key in business code. I have to modify crate db-key directly.

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