Open
Description
It would be really nice for quick prototyping if there was an assist that could generate a struct or enum definition given a corresponding literal with an undefined type name at the front.
Record struct:
let foo = Foo$0 { field: "hello".to_owned() };
// generate type definition
struct Foo {
field: String,
}
Tuple struct:
let foo = Foo$0("world");
// generate type definition
struct Foo<'a>(&'a str);
Enum:
let bar = Foo$0::Bar;
let baz = Foo::Baz;
// generate type definition
enum Foo {
Bar,
Baz,
}
(and equivalent for enums with tuple or record fields)