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
Unable to clone model fields in view!
macro
#576
Comments
It looks like this is already handled as mentioned in #162 (comment), but it doesn't look like such behavior is currently documented. Does the documentation for that not exist, or am I just looking in the wrong place? |
I looked here in the documentation as well, and it also doesn't appear such behavior is documented. |
Something I found a bit surprising is that using the // Automatically clones `sender`
connect_changed[sender] => move |name_input| { ...
// Doesn't clone `model.errors`
connect_changed[errors = model.errors, sender] => move |name_input| { ...
// Clone's `model.errors` through manual `.clone()` call
connect_changed[errors = model.errors.clone(), sender] => move |name_input| { ... Since the I can't really think of a case where you'd just rename with the |
This is because you might not want to use |
I was mostly wondering when you wouldn't want to though, as I was thinking you'd pretty much always want to clone when using stuff like That makes enough sense to me, but the currently behavior for the |
Yes, documentation is missing and we could add a shorter syntax for cloning struct fields, so we can keep this issue open until this is resolved. |
I'm trying to do something similar to this inside a
view!
macro in my codebase:This is currently failing to compile though:
I'm assuming this should be allowed since
glib::clone!
allows for it (see https://gtk-rs.org/gtk-rs-core/stable/latest/docs/glib/macro.clone.html#errors). I'm not sure how easy this would be to add support for in the parser though, but it would make my code significantly cleaner if I was able to.The text was updated successfully, but these errors were encountered: