Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MustVerify ¶
func MustVerify(v any)
MustVerify is like Verify but panics if a contract is violated.
Types ¶
type Implements ¶
type Implements[T any] struct{}
Implements is a zero-cost marker used to declare that a struct implements an interface T.
Usage:
type MyService struct {
contracts.Implements[IService]
}
This enables: 1. IDE navigation: Clicking IService takes you to the interface definition. 2. IDE discovery: "Find Usages" on IService will show MyService. 3. Runtime validation: contracts.Verify(&MyService{}) checks if the implementation is valid.
Click to show internal directories.
Click to hide internal directories.