DataExt

Trait DataExt 

Source
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§

Source

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.

Source

fn variants(&self) -> Vec<Vec<(&Visibility, TokenStream, &Type)>>

Source

fn tag(&self) -> Option<Ident>

Implementations on Foreign Types§

Source§

impl DataExt for Data

Source§

impl DataExt for DataEnum

Source§

impl DataExt for DataStruct

Source§

impl DataExt for DataUnion

Implementors§