-
Notifications
You must be signed in to change notification settings - Fork 157
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
confused by moved_ownership example #348
Comments
I don't mind expanding the example if it would help to clarify for others, can you give me an example of the error you're coming up against? The intent of the example is to give people an understanding of why they are possibly encountering ownership issues (which isn't really a limitation of the macro per se). |
Sorry to wake up an old thread, but I just ran into this issue as well. I had some central config for my app, loaded from a I realized that I couldn't just do what the example shows, because my app has multiple endpoints, like I solved the error by using an But I'm still not sure I did the right thing! Cloning a reference counter around a resource for every single endpoint doesn't scale well at all, so I'm hoping there's a better way that I just don't know yet. I'm really new to Rust, so I would benefit from a better example to know I'm doing it the right way. It would be great if the example had two endpoints defined that both relied on the same non-Copy type. |
The One way around this is to use the server data, set with |
@jolhoeft thanks for the tips! The context helps me understand the examples better now. I'd be happy to contribute to the examples to point other beginners in the right direction. I originally found the I could add some comments to the file directing beginners to some other examples. I think What do you think would be best? |
Sorry I missed this. If you are still interested, a few comments on the existing example would be great. The additional example is good to. |
Hello,
i hope it's fine that i opened this issue - it's more or less a question, not a real issue.
i am trying to pass (cone) a struct what owns a String from my main function to a handler,
more or less the same like:
https://github.com/nickel-org/nickel.rs/blob/master/examples/moved_ownership.rs
for rust / nickel beginners it's really hard so understand the limitations of the middleware! macro.
could you add some more complex examples (structs / mutable / ...) about this topic?
The text was updated successfully, but these errors were encountered: