pub trait HKT {
type Type<T>;
}Expand description
Re-exports the core HKT trait for arity-1 Higher-Kinded Types.
Trait for a Higher-Kinded Type (HKT) with one type parameter (arity 1).
This trait is implemented by a concrete “witness” type (e.g., OptionWitness)
which serves as a token to refer to a type constructor (e.g., Option<T>).
The Type<T> associated type defines the actual type constructor, with <T>
representing the single generic parameter that can vary.
§Purpose
Enables writing generic code that can operate over different type constructors
(like Option, Vec, Result with a fixed error type) without knowing their
concrete inner type. This is a core building block for functional programming
abstractions like Functor, Applicative, and Monad in Rust.
§Type Parameters
T: The generic type parameter that the type constructor operates on.
Required Associated Types§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.