Apply!() { /* proc-macro */ }Expand description
Applies a brand to type arguments.
This macro projects a brand type to its concrete type using the appropriate
Kind trait. It uses a syntax that mimics a fully qualified path, where the
Kind trait is specified by its signature.
§Syntax
ⓘ
Apply!(<Brand as Kind!( KindSignature )>::AssocType<Args>)§Parameters
Brand: The brand type (e.g.,OptionBrand).KindSignature: A list of associated type definitions defining theKindtrait schema.AssocType: The associated type to project (e.g.,Of).Args: The concrete arguments to apply.
§Generates
The concrete type resulting from applying the brand to the arguments.
§Examples
ⓘ
// Invocation
// Applies MyBrand to lifetime 'static and type String.
type Concrete = Apply!(<MyBrand as Kind!( type Of<'a, T>; )>::Of<'static, String>);
// Expanded code
type Concrete = <MyBrand as Kind_...>::Of<'static, String>;ⓘ
// Invocation
// Applies MyBrand to a generic type T with bounds.
type Concrete = Apply!(<MyBrand as Kind!( type Of<T: Clone>; )>::Of<T>);
// Expanded code
type Concrete = <MyBrand as Kind_...>::Of<T>;ⓘ
// Invocation
// Complex example with lifetimes, types, and output bounds.
type Concrete = Apply!(<MyBrand as Kind!( type Of<'a, T: Clone + Debug>: Display; )>::Of<'a, T>);
// Expanded code
type Concrete = <MyBrand as Kind_...>::Of<'a, T>;ⓘ
// Invocation
// Use a custom associated type for projection.
type Concrete = Apply!(<MyBrand as Kind!( type Of<T>; type SendOf<T>; )>::SendOf<T>);
// Expanded code
type Concrete = <MyBrand as Kind_...>::SendOf<T>;