Skip to content
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

derive: allow split up template attributes #117

Merged
merged 1 commit into from
Aug 7, 2024

Conversation

Kijewski
Copy link
Collaborator

@Kijewski Kijewski commented Aug 7, 2024

In generated code or macros, it might be useful to emit multiple #[template] attributes. E.g.

 #[template(source = "Hello!")]
 #[template(ext = "txt")]
 struct Hello;

In generated code or macros, it might be useful to emit multiple
`#[template]` attributes. E.g.

```rust
 #[template(source = "Hello!")]
 #[template(ext = "txt")]
 struct Hello;
```
@Kijewski Kijewski force-pushed the pr-template-times-x branch from c75e32a to f25dac9 Compare August 7, 2024 05:09
@GuillaumeGomez
Copy link
Contributor

Nice add! Can you add a test like this please:

#[derive(Template)]
#[template(source = "bla")]
#[template(source = "bla")]
struct Foo;

Just to confirm the parsing of attributes is taking duplicates into account when they are not in the same attribute.

@Kijewski
Copy link
Collaborator Author

Kijewski commented Aug 7, 2024

Just to confirm the parsing of attributes is taking duplicates into account when they are not in the same attribute.

That's done in https://github.com/rinja-rs/rinja/pull/117/files#diff-d2f7c348bb75850b1706f0efcd72e6b6c82baff6803d2e0aa5ca0521fe159ad2. Before it failed because there were two #[template]s, now in fails because the source is given twice.

@GuillaumeGomez
Copy link
Contributor

Oh wow, how did I miss that... Sorry for missing it. Thanks!

@GuillaumeGomez GuillaumeGomez merged commit ebcfff6 into rinja-rs:master Aug 7, 2024
17 checks passed
@Kijewski Kijewski deleted the pr-template-times-x branch August 7, 2024 15:22
@Kijewski
Copy link
Collaborator Author

Kijewski commented Aug 7, 2024

Oh wow, how did I miss that...

Hehe, don't worry. I could have made the it more explicit bei adding a new test instead of changing the meaning of an existing one.

@Kijewski Kijewski mentioned this pull request Aug 8, 2024
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.

2 participants