Trait
Named surface set that implementers must provide
Mechanism
A marker interface: a named set of surfaces a pattern requires of anything claiming it, so a caller can invoke across implementations without knowing which one it holds. A Trait has no instances of its own — it is claimed by other patterns, which supply the surfaces it names. Distinct from Protocol, which is a Trait whose exchange must hold between two or more parties, and from Contract, which is a signed agreement rather than a type claim.
Invariants
- Names the surfaces an implementer must provide, and which of them are mandatory.
- Non-instantiable: a Trait is claimed by another pattern and has no standalone instance.
- Says nothing about how the surfaces are implemented.
Failure modes
- Claimed without provision: a pattern declares the Trait and omits a mandatory surface, so callers dispatch to something that cannot answer.
- Surface set widened after adoption: adding a mandatory surface breaks every existing claimant, which is why the set is part of the Trait's identity.
Where this came from
—
Builds on
Used by
- Solver references
Identity
- Ref:
Trait#e415 - Hash: sema:Trait#mh:SHA-256:e415fe6619857f831d831228b5532ea64d4a6a222773c828098f30d36f450b20
- Library: bootstrap 0.11.0, root a6a3d1ff0f98
- License: Not stated; check the repository