-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
A-assistsS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now
Description
The Intellij plugin generates literals for some types when filling struct fields.
If I remember correctly, this is String::new() for strings, Vec::new() for vectors, 0 / 0.0 for numbers, false for bools.
I like this behaviour since it let's me know the type, and provides a valid initialization.
I checked the code and I'm happy to implement this, but I wanted to discuss desired semantics first.
Eg, strings could also be implemented as "".to_string() instead of String::new(). Similarly, Vec could be vec![]. This would make it easier to provide your own values.
For other types, we could check if the type implements Default, and use T::default().
jplatte
Metadata
Metadata
Assignees
Labels
A-assistsS-actionableSomeone could pick this issue up and work on it right nowSomeone could pick this issue up and work on it right now