I might be blind by not finding a proper short cut and the issue might not be of huge relevance,
but why do we have to take on the hustle to recall Self-returning functions in such a verbose manner?
struct WeightedValue {...}
...
let list: Vec<WeightedValue> = vec![
WeightedValue::new(1, 1),
WeightedValue::new(3, 4),
WeightedValue::new(5, 8),
];
I have been looking for a short way, like something like this:
let list: Vec<WeightedValue> = vec![new(1, 1),new(3, 4),new(5, 8)];
..to allow Vec<structs> to be initializes by short circuiting the initialization to Self-returning functions of the struct implementation.
or even shorter, by just providing values to fill fields - assuring type by vec-Type-definition/pattern matching on struct declaration..
let list: Vec<WeightedValue> = vec![{1, 1},{3, 4},{5, 8}];
A different problem I can think of atm, is about str to String conversion, wouldn't it be valid to "auto-convert" this,
by copying the slice at runtime?
Even a style like Tuple-Structs would be less verbose & easier to read. - in my opinion.
Any ideas?