In role Metamodel::Mixins§

See primary documentation in context for method mixin

method mixin($obj, *@roles, :$needs-mixin-attribute)

Generates a new mixin type by calling generate_mixin with $obj and @roles. If $obj is composed, the mixin cache of $obj will be checked for any existing mixin for these beforehand. If $obj is an instance of a type, this will return $obj reblessed with the mixin generated, otherwise this will return the mixin itself.

If $needs-mixin-attribute is True, this will throw an exception if no mixin attribute exists on the mixin generated before returning.