Skip to content

Cannot return HashMap value. #210

Answered by khvzak
irishgreencitrus asked this question in Q&A
Discussion options

You must be logged in to vote

There are few options:

  1. Store PackageManager inside Rc<RefCell>:
struct PackageScope {
    builtins: HashMap<String, Rc<RefCell<PackageManager>>>,
    user: String,
}

Then you can send it to Lua (cloned by reference).

  1. Store RegistryKey as Rc<RegistryKey>, this would allow to implement Clone for PackageManager

  2. Store PackageManager directly inside Lua and refer to each instance via RegistryKey, eg:

struct PackageScope {
    builtins: HashMap<String, RegistryKey>,
    user: String,
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@irishgreencitrus
Comment options

Answer selected by irishgreencitrus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants