TypeDecl::impl_head
pub fn impl_head(string bound) -> Code Import
Source: use macro::{TypeDecl}; compiler/src/prelude/macro.hy Head of an impl Trait for … for this type: Name, or for a generic type Name<T: bound, U: bound>, every type parameter bounded by bound ("Show", "Ord + Eq"). Write impl ${trait} for ${t.impl_head("Show")} so a derive covers generic types too.
Called on a TypeDecl value as value.impl_head(…).
Parameters#
| Name | Type |
|---|---|
bound | string |
Returns#
Code
See also#
TypeDecl: A class or enum declaration handed to a derive or attribute macro.TypeDecl::is_classTypeDecl::self_type: The type as written in a signature:Name, orName<T, U>for a generic type.TypeDecl::is_enumTypeDecl::fields: Class fields (empty for an enum).TypeDecl::variants: Enum variants (empty for a class).TypeDecl::has_attrTypeDecl::attr_str