Derives: Custom behavior (Reference)¶
This page lists the dunder hooks used to customize derived behavior.
See also:
- Derives & traits
- Customize derived behavior (How-to)
- Stdlib traits
- Reflection (for
__fields__()/__class_name__())
Dunder hooks¶
| Hook | Purpose |
|---|---|
__str__ |
Display formatting ({value}) |
__eq__ |
Equality (==, !=) |
__lt__ |
Ordering (<, sorting) |
__hash__ |
Hashing (Set / Dict keys) |
Rule:
- You must not combine a hook with the corresponding
@derive(...)(conflict).