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

Change RedbKey and RedbValue to Key and Value #727

Closed
casey opened this issue Nov 27, 2023 · 3 comments
Closed

Change RedbKey and RedbValue to Key and Value #727

casey opened this issue Nov 27, 2023 · 3 comments

Comments

@casey
Copy link
Contributor

casey commented Nov 27, 2023

I think it's slightly more idiomatic to not prefix types with the crate name. If these names conflict with local type names, they can be referred to as redb::Key and redb::Value, which is still short, since redb is only four letters.

API breakage can be avoided by doing a hidden re-export:

#[doc(hidden)]
type RedbKey = Key;

#[doc(hidden)]
type RedbValue = Value;
@cberner
Copy link
Owner

cberner commented Nov 28, 2023

ya, that does seem better. Although I'll probably go with KeyType and ValueType that seems more descriptive to me.

I'm getting a compiler error from the aliasing though. Do you know how to export an alias of a type with GATs? It looks to me like it's not possible: only generic params are allowed. https://doc.rust-lang.org/reference/items/type-aliases.html

@casey
Copy link
Contributor Author

casey commented Nov 28, 2023

ya, that does seem better. Although I'll probably go with KeyType and ValueType that seems more descriptive to me.

I dunno, everything's a type. It also seems a bit like including the type of a variable in the name, e.g., a string variable named foo_string.

I'm getting a compiler error from the aliasing though. Do you know how to export an alias of a type with GATs? It looks to me like it's not possible: only generic params are allowed. https://doc.rust-lang.org/reference/items/type-aliases.html

Oh that's annoying. I don't know if there's a workaround for that.

@cberner
Copy link
Owner

cberner commented Nov 29, 2023

Oh that's annoying. I don't know if there's a workaround for that.

Ya, I don't think it's possible from what I can tell. I'm going to merge this into #677

@cberner cberner closed this as completed Nov 29, 2023
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