Open apps4uco opened 2 years ago
You probably don't even have to use _code
. This works:
#[default(vec!["en".to_owned()])]
knows_language: Vec<String>,
The reason your code didn't work is that "en"
is not a String
- it's an &str
. The compiler error message does tell you that. I do see a problem with _code
here - when you use it it points you at the #[derive]
attribute:
1 | #[derive(SmartDefault)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^- help: try using a conversion method: `.to_string()`
| |
| expected struct `String`, found `&str`
While when you don't use it it points you at the correct place:
9 | #[default(vec!["en"])]
| ^^^^- help: try using a conversion method: `.to_string()`
| |
| expected struct `String`, found `&str`
So this is one thing I should probably fix.
Hi,
Im not sure if it is supported, but in any case it would be useful to document
I tried
and
and