Expand description
Delegation typestate for compile-time safety of delegation lifecycle.
Uses the typestate pattern to make invalid state transitions uncompilable.
§State Transition Diagram
create() → Pending ──┬── accept() ──→ Accepted ── start() → InProgress ──┬── complete() → Completed
├── reject() ──→ Rejected (terminal) └── fail() → Failed (terminal)
└── timeout() ─→ Failed (terminal)Modules§
- private 🔒
Structs§
- Delegation
- A delegation with compile-time state tracking.
- Delegation
Accepted - Delegation was accepted but not yet started.
- Delegation
Completed - Delegation was completed successfully (terminal).
- Delegation
Failed - Delegation failed (terminal).
- Delegation
Record - Internal data storage for a delegation, independent of typestate. This is what gets persisted to the database.
- Delegation
Rejected - Delegation was rejected (terminal).
- Delegation
Result - Result of a completed delegation.
- InProgress
- Delegation work is in progress.
- Pending
- Delegation is pending acceptance.
- Stored
Delegation - A delegation as stored in the database (status-agnostic).
Enums§
- Delegation
Result Status - Status of a delegation result.
- Delegation
State Error - Errors when transitioning delegation states.
- Delegation
Status - Status of a delegation operation.
- Loaded
Delegation - Enum representing all possible runtime states of a delegation. Use this when you need to handle delegations loaded from the database.
Traits§
- Delegation
State - Marker trait for delegation states.