trait bound
A rule on a generic type saying what it must be able to do, like "P must be an output pin".
A trait bound (P: OutputPin) restricts a generic parameter to types implementing a trait, so the generic code may call that trait's methods and works with any conforming type.
Examples
fn blink<P: OutputPin>(pin: &mut P)has the trait boundP: OutputPin, so it accepts the fan's esp-halOutputand rejects types that can't be set high.Passing a value whose type doesn't implement
OutputPinto that function is a compile error, not a run-time failure.
See also