InferableBrand!() { /* proc-macro */ }Expand description
Generates the name of an InferableBrand trait based on its signature.
This macro is analogous to Kind! but produces InferableBrand_{hash}
identifiers instead of Kind_{hash}. Both macros use the same content
hash, so a Kind trait and its corresponding InferableBrand trait
always share the same hash suffix.
§Syntax
InferableBrand!(
type AssocName<Params>: Bounds;
// ...
)Associated Types: A list of associated type definitions (e.g.,type Of<T>;) that define the signature of the InferableBrand.
§Generates
The name of the generated InferableBrand trait (e.g., InferableBrand_0123456789abcdef).
The name is deterministic and based on the same hash as the corresponding Kind trait.
§Examples
// Invocation
let name = InferableBrand!(type Of<'a, A: 'a>: 'a;);
// Expanded code
let name = InferableBrand_...; // e.g., InferableBrand_cdc7cd43dac7585f// Inside Apply! (the primary use case)
Apply!(<<FA as InferableBrand!(type Of<'a, A: 'a>: 'a;)>::Brand as Kind!(type Of<'a, T: 'a>: 'a;)>::Of<'a, B>)§Limitations
Due to Rust syntax restrictions, this macro cannot be used directly in positions where a concrete path is expected by the parser, such as:
- Trait bounds:
FA: InferableBrand!(...) {}(Invalid) - Qualified paths:
<FA as InferableBrand!(...)>::Brand(Invalid)
In these positions, use the generated name directly (e.g., InferableBrand_cdc7cd43dac7585f).
Inside Apply!(), the macro is supported and resolved automatically via preprocessing.