You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As of #22, value and type trait definitions are no longer a part of the trait macro. It would be great to roll this all back up into the macro, but this would probably require procedural macros (at the very least for converting the associated enum type into a snake case method, if not more). Procedural macros only support derives right now IIRC and require a separate crate, both of which aren't ideal. Maybe we can hardcode the method name into the regular macro invocation to avoid the trouble...
I'm imagining something like:
trait_type_set!{/// Represents any LLVM type.AnyType requires AsTypeRef + Debug enumerated by AnyTypeEnum[BasicTypeEnum,IntType,FunctionType,FloatType,PointerType,StructType,ArrayType,VoidType,VectorType]}
Which would expand to:
/// Represents any LLVM type.pubtraitAnyType:AsTypeRef + Debug{/// Returns a `AnyTypeEnum` that represents the current type.fnas_any_type_enum(&self) -> AnyTypeEnum{AnyTypeEnum::new(self.as_type_ref())}}
along with the trait impls for each provided type.
This isn't a big deal, but would make traits more DRY, so I'm leaving this as a wishlist item.
The text was updated successfully, but these errors were encountered:
As of #22, value and type trait definitions are no longer a part of the trait macro. It would be great to roll this all back up into the macro, but this would probably require procedural macros (at the very least for converting the associated enum type into a snake case method, if not more). Procedural macros only support derives right now IIRC and require a separate crate, both of which aren't ideal. Maybe we can hardcode the method name into the regular macro invocation to avoid the trouble...
I'm imagining something like:
Which would expand to:
along with the trait
impl
s for each provided type.This isn't a big deal, but would make traits more DRY, so I'm leaving this as a wishlist item.
The text was updated successfully, but these errors were encountered: