You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use this crate a lot, also in combination with getset and ever since getset was modified to return &mut Self to allow chaining setters it requires changing all the delegated setters to also return &mut Member, which requires more typing and it leaks the member as mutable as a whole! Anyone can now completely modify the member through this public setter that is only supposed to allow the modification of 1 field of this member.
E.g. I want to write:
just like I was writing before getset switched to chaining setters, but it complains:
error: mismatched types
error: this error originates in a macro outside of the current crate
error: expected (), found mutable reference
error: expected `()` because of default return type
note: expected type `()` found type `&mut Lfo`
help: this error originates in a macro outside of the current crate
help: try adding a semicolon
But ideally I want delegate_method to allow me to write the first version and then ignore the return value of the delegated method, and return () instead.
Would it be possible to allow this in delegate_method? :)
It should be technically possible to always return () when no return type is specified (ignoring the value returned by the member's method), this will also work for methods that actually return () but also those that don't.
The text was updated successfully, but these errors were encountered:
I use this crate a lot, also in combination with
getset
and ever sincegetset
was modified to return&mut Self
to allow chaining setters it requires changing all the delegated setters to also return&mut Member
, which requires more typing and it leaks the member as mutable as a whole! Anyone can now completely modify the member through this public setter that is only supposed to allow the modification of 1 field of this member.E.g. I want to write:
just like I was writing before
getset
switched to chaining setters, but it complains:Instead, I have to write:
But ideally I want
delegate_method
to allow me to write the first version and then ignore the return value of the delegated method, and return()
instead.Would it be possible to allow this in
delegate_method
? :)It should be technically possible to always return
()
when no return type is specified (ignoring the value returned by the member's method), this will also work for methods that actually return()
but also those that don't.The text was updated successfully, but these errors were encountered: