pub(crate) trait DataExt {
// Required methods
fn fields(&self) -> Vec<(&Visibility, TokenStream, &Type)>;
fn variants(&self) -> Vec<Vec<(&Visibility, TokenStream, &Type)>>;
fn tag(&self) -> Option<Ident>;
}Required Methods§
Sourcefn fields(&self) -> Vec<(&Visibility, TokenStream, &Type)>
fn fields(&self) -> Vec<(&Visibility, TokenStream, &Type)>
Extracts the names and types of all fields. For enums, extracts the
names and types of fields from each variant. For tuple structs, the
names are the indices used to index into the struct (ie, 0, 1, etc).
FIXME: Extracting field names for enums doesn’t really make sense. Types makes sense because we don’t care about where they live - we just care about transitive ownership. But for field names, we’d only use them when generating is_bit_valid, which cares about where they live.