Skip to content

Fix method call on enum variant templates#635

Merged
GuillaumeGomez merged 2 commits intoaskama-rs:mainfrom
GuillaumeGomez:method-call-enum-variants
Dec 20, 2025
Merged

Fix method call on enum variant templates#635
GuillaumeGomez merged 2 commits intoaskama-rs:mainfrom
GuillaumeGomez:method-call-enum-variants

Conversation

@GuillaumeGomez
Copy link
Copy Markdown
Collaborator

Fixes #599.
Follow-up of #255.

This fix sadly comes at a price: it relies on Deref to work, so traits (like Debug) won't work anymore right from the box. However now we can call methods, so not perfect, but as a first iteration, I'm satisfied.

)"
"&enum::test_simple_enum::_::__Askama__SimpleEnum__G<enum::X> | G"
// output since rustc 1.91.0-nightly 2025-08-17
| "&enum::test_simple_enum::_::__Askama__SimpleEnum__G<'_, '_, enum::X> | \
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could keep this Debug impl by skipping the original struct but I don't really see the point here.

@GuillaumeGomez
Copy link
Copy Markdown
Collaborator Author

No clue why custom_ui fails. Seems unrelated to that PR, re-check tomorrow.

@GuillaumeGomez GuillaumeGomez force-pushed the method-call-enum-variants branch from c8c66a9 to 3c7eae4 Compare December 20, 2025 22:50
@GuillaumeGomez GuillaumeGomez force-pushed the method-call-enum-variants branch from 3c7eae4 to 87429c8 Compare December 20, 2025 22:56
@GuillaumeGomez GuillaumeGomez merged commit 4e85c10 into askama-rs:main Dec 20, 2025
51 checks passed
@GuillaumeGomez GuillaumeGomez deleted the method-call-enum-variants branch December 20, 2025 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enum variant specific template annotations cannot call methods

1 participant