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

Cannot find derive macro Model in this scope #64

Closed
adamfriedland opened this issue Oct 16, 2020 · 3 comments
Closed

Cannot find derive macro Model in this scope #64

adamfriedland opened this issue Oct 16, 2020 · 3 comments
Labels
disposition:close The tagged item can probably be closed

Comments

@adamfriedland
Copy link

I seem to be having an issue inserting this derived trait into my scope. I'm using the standard example on the read me available as well. I'm using the latest stable build of Rust currently which at this time is 1.47.0. I'm still rather green to the language so apologies in advance if this is some silly issue.
image

@thedodd
Copy link
Owner

thedodd commented Oct 16, 2020

Hey @adamfriedland no problem. You will notice here (https://github.com/thedodd/wither/blob/master/wither/examples/readme.rs) that the example code actually uses the following import: use wither::{prelude::*, Result};, so in your code sample above, I would recommend that you replace your use wither::Model; with user wither::prelude::*;.

What is happening here is that you are actually importing the wither::Model trait, not the derive macro. They are both named the same, however the prelude module exposes them both.

The other option, depending on your preference, would be to modify your derive to be #[derive(Debug, wither::Model, ...)] because Rust will know that you are referring to the derive-macro in that case.

Cheers

@thedodd thedodd added the disposition:close The tagged item can probably be closed label Oct 16, 2020
@adamfriedland
Copy link
Author

Yes, I took at look at the references and saw what you meant. There appears to be reference ambiguity that the compiler doesn't know how to resolve correctly. Prior to this, I did end up just opting into the alpha build and that actually resolved quite a few of the issues I had, even if it sacrifices indexing in the interim. Keep up the good work @thedodd. We need a good strongly typed mongodb implementation.

@thedodd
Copy link
Owner

thedodd commented Oct 20, 2020

@adamfriedland awesome! Glad to hear it. Thanks for the encouragement :). Definitely a lot going on, but hopefully we'll be able to get the index PR landed soon so we can cut the official 0.9 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition:close The tagged item can probably be closed
Projects
None yet
Development

No branches or pull requests

2 participants