-
Notifications
You must be signed in to change notification settings - Fork 35
access to &self
in display()
#6
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
Comments
Well, I'm okay with this proposal. But I'm not sure it's possible. You will need to define name "self" in this code too because of macro hygiene. Like |
You are right - this is macro hygiene. It should work by passing a closure like The question then is how to react if someone defines both |
Ok, you were right again. Passing a closure didn't work. With PR #8 the macro uses closures internally now, but the signature of I was also thinking about trying to overload the definition of Regarding the question of duplicate |
Well, I think the syntax should be:
Because there is a similar |
Hm, I can't get it to work - rust either complains
or
Depending on which matcher comes first:
|
@colin-kiegel, I think I've figured out a way to do that in #10. Could you take a look if I'm missing something? I will probably squash the commits then. |
Author: Colin Kiegel <[email protected]>
I would like to reuse the error description in the Display::fmt function on some occasions. It would be nice to do this by delegation to self.description(). There might be addional usecases for
&self
access.The text was updated successfully, but these errors were encountered: