pub trait ControlPolicy: Send + Sync {
// Required method
fn name(&self) -> &'static str;
// Provided methods
fn enter_prompt(&self, _cx: &mut Cx, _prompt: &ControlPrompt) -> Result<()> { ... }
fn capture(&self, cx: &mut Cx, _capture: &ControlCapture) -> Result<Ref> { ... }
fn abort(&self, cx: &mut Cx, _abort: &ControlAbort) -> Result<Ref> { ... }
fn resume(&self, cx: &mut Cx, _resume: &ControlResume) -> Result<Ref> { ... }
}Expand description
Policy implementing delimited control: prompts, capture, abort, and resume.
The kernel defines this contract and the records it consumes; libraries supply the concrete continuation machinery. Unsupported operations report an “unsupported” control result rather than failing hard.
Required Methods§
Provided Methods§
Sourcefn enter_prompt(&self, _cx: &mut Cx, _prompt: &ControlPrompt) -> Result<()>
fn enter_prompt(&self, _cx: &mut Cx, _prompt: &ControlPrompt) -> Result<()>
Enter a prompt boundary; the default is a no-op.
Sourcefn capture(&self, cx: &mut Cx, _capture: &ControlCapture) -> Result<Ref>
fn capture(&self, cx: &mut Cx, _capture: &ControlCapture) -> Result<Ref>
Capture the continuation up to a prompt; defaults to unsupported.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".