Closed rksm closed 4 months ago
The problem is that I parse #[builder(...)]
attribute by pretending it's a function call and the settings are assignments (Rust - or at least the syn crate - treats assignments as expressions at the parser level and only disallows them at a later stage). This allows me to use complex syntax instead of wrapping everything with strings, but the downside is cases like this.
Maybe some day I'll replace it with a manual parsing (that still uses the syn crate, but doesn't pretend the attribute is something it is not) which will make such syntax possible. Don't hold your breath though.
Luckily, the turbofish syntax - which is required in expressions - can also be used for types. This means that this works:
#[builder(build_method(into = Result::<Index>))]
Not as pretty, but it's going to have to do.
Yep, I understand, parsing macros can be gnarly. Your suggested workaround is good enough, thanks!
Hello and thank you for this amazing project! It makes builder type state so much easier to use, it's a joy!
I've come across a small issue. I have
into = Result<Index>
is not parsed correctly as apparently the macro does not expect type params. I can work around this withtype IndexResult = Result<Index>;
but it would be cool if this could be supported directly.Thank you!