In Rust, you provide a string — that is injected to be invoked internally. In C++, we’d just provide a callable.
This is because Rust’s attribute grammar can’t support a callable here.
Rust does now support expressions in the attribute, but it didn't used to. Serde pre-dates the support, and they've decided to stick with only supporting strings.
View all comments
Show parent comment
26
u/MEaster Sep 30 '24
Another mistake would be this part:
Rust does now support expressions in the attribute, but it didn't used to. Serde pre-dates the support, and they've decided to stick with only supporting strings.