// Everything is non_exhaustive and public// (not sure how to handle private fields...)/// Result of `typeinfo!`structType{name:&'staticstr,// result of `type_name`inner:TypeInner,layout:Layout,generics:&'static[Generic],lifetimes:&'static[Lifetime],}implType{/// Defer to `StructTy::field`, panic if not a structconstfnfield(name:&'staticstr) -> &'staticStructField;/// Defer to `EnumTy::variant`, panic if not an enumconstfnvariant(name:&'staticstr) -> &'staticEnumVariant;}enumTypeInner{Struct(StructTy),Enum(EnumTy), ...}structStructTy{fields:&'static[Field]}structEnumTy{variants:&'static[EnumVariant]}structEnumVariant{fields:&'static[Field],discriminant:Discriminant,value:Option<isize>// Value of C-style enums}structField{type:Type,// Field typename:Option<&'staticstr>,// Field name if a named structfield_index:usize,// Field count within the struct as definedoffset:usize,// offset in implementation}implField{// Helpers to get or set a field on the parent struct// Not sure what this would do for enumsconstfngetter(&self) -> (fn(&ParentTy) -> SelfTy);constfnsetter(&self) -> fn(&mutParentTy,SelfTy);}structGeneric{ty:Type,default:Option<Type>}implStructTy{// similar for EnumTy with Variant/// Get a field by name at compile time, compile_error if it doesn't existconstfnfield(name:&'staticstr) -> &'staticField;}// ...
Sep 9th - Can't have const fn in trait, maybe use associated constants in traits
per fee1-dead