pub trait Directive<Discriminant: DiscriminantTag = ()>: Sized {
// Required methods
fn precision(&self) -> Precision;
fn fortitude(&self) -> Fortitude;
fn new(precision: Precision, fortitude: Fortitude) -> Self;
}Expand description
A trait expressing the execution directive of an operation.
Directive defines how an action should be carried out, independent of
the value or state it operates on. It captures two orthogonal dimensions:
-
[
Precision]: The required exactness of the operation.Exact: The operation must satisfy strict conditions.BestEffort: The operation may proceed with relaxed or partial fulfillment.
-
[
Fortitude]: The strength or authority of execution.Polite: The operation should respect constraints and may yield.Force: The operation must be enforced regardless of resistance.
§Interpretation
| Precision | Fortitude | Meaning |
|---|---|---|
| BestEffort | Polite | Soft, optional attempt |
| Exact | Polite | Strict but non-forcing |
| BestEffort | Force | Enforced but flexible execution |
| Exact | Force | Strict and mandatory execution |
§Design Notes
- Encodes intent, not state or value
- Fully domain-agnostic
- Separates what to do from how to do it
- Enables consistent execution behavior across systems
Implementations should ensure that from_directive produces a value whose
behavior reflects the specified execution semantics.
§Default Discriminant
Discriminant = (): defines a single default directive, meaning one unique set of directions is assumed.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.