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

Returning KeyNode<&Self, B> makes storage of KeyNode pretty hard #2

Open
janstarke opened this issue Jan 13, 2022 · 1 comment
Open

Comments

@janstarke
Copy link

Hi, I currently try to use this library in a tool of mine (https://github.com/janstarke/regview). However, I've a lot of trouble while storing KeyNodes in a datastructure, because they need to have a reference lifetime in their generic parameters:

struct MyDataStructure<'a> {
  current_node: Rc<RefCell<KeyNode<&'a Hive<MyByteSlice>, MyByteSlice>>>
}

Is there a way to change the API, so that the caller chooses which DeRef-implementation shall be used? I could imagine that one preferably used Rc<Hive> or something similar when building dynamic data structures.

Kind regards, Jan

@janstarke
Copy link
Author

Using custom type without lifetime parameters solves a lot these issues. However, this requires that this type can implement zerocopy::ByteSlice, which is forbidden. See #3 as idea of how to solve this

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