Is there a way to define a type in terms of the type of a field of a struct in Rust?
Such as:
struct Person {
id: i32,
}
type PersonId = Person::id;
(I know that I could define PersonId as i32 and make Person use that, but I am not interested in this use case. My particular use case is code-generation, so it would help if my Rust outputs are more similar to the other input language.)
TypeScript has an analogous concept, if this helps explain what I am asking for: https://www.typescriptlang.org/docs/handbook/2/indexed-access-types.html