pub trait ActionItem: Sized + Send {
type Accepted: Send;
type Rejection: Send;
type Prerequisite: Send;
// Provided method
fn retain_accepted(_: Self::Accepted) -> Option<Self::Accepted> { ... }
}Expand description
One concrete value that can occur in crate::Actions.
The capability item owns its settlement vocabulary. Every conforming
interpreter therefore agrees on the exact accepted receipt, rejection,
and prerequisite types for that item. Interpreter corruption is the one
shared InterpreterFault sum.
A runtime cannot substitute a different rejection type for the same item:
struct Request;
struct RequiredRejection;
struct RuntimeRejection;
impl behavior::ActionItem for Request {
type Accepted = ();
type Rejection = RequiredRejection;
type Prerequisite = behavior::Never;
}
struct Runtime;
impl behavior::InterpretItem<Request, (), behavior::Here> for Runtime {
fn interpret_item(
&mut self,
item: Request,
) -> impl core::future::Future<
Output = behavior::ItemSettlement<
Request,
(),
RuntimeRejection,
behavior::Never,
>,
> + Send {
async move {
behavior::ItemSettlement::Rejected { item, reason: RuntimeRejection }
}
}
}Required Associated Types§
Provided Methods§
Sourcefn retain_accepted(_: Self::Accepted) -> Option<Self::Accepted>
fn retain_accepted(_: Self::Accepted) -> Option<Self::Accepted>
Keep an accepted value only while it still carries terminal custody.
The default discharges and destroys the receipt. An implementation
returning Some must return the same owned value on every later offer;
it must not perform an effect or consume authority still promised by
that value. This decision does not change settlement status.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".