pub struct ProtectedRunner<S: CheckpointStore> { /* private fields */ }Expand description
Protected Runner
Wraps a Runner with input processor pipeline and optional protected emitter. Input is validated/transformed BEFORE execution begins.
§Usage
ⓘ
use enact_core::runner::{ProtectedRunner, DefaultRunner};
use enact_core::policy::{PiiInputProcessor, PiiInputMode};
let runner = DefaultRunner::default_new();
let protected = ProtectedRunner::new(runner)
.with_input_processor(Arc::new(
PiiInputProcessor::new().with_mode(PiiInputMode::BlockDirect)
));
// Input will be validated before callable runs
let result = protected.run_callable(&my_callable, "user input").await;Implementations§
Source§impl<S: CheckpointStore> ProtectedRunner<S>
impl<S: CheckpointStore> ProtectedRunner<S>
Sourcepub fn new(runner: Runner<S>) -> Self
pub fn new(runner: Runner<S>) -> Self
Create a new protected runner wrapping an existing runner
Sourcepub fn with_input_processor(self, processor: Arc<dyn InputProcessor>) -> Self
pub fn with_input_processor(self, processor: Arc<dyn InputProcessor>) -> Self
Add an input processor to the pipeline
Sourcepub fn with_protected_emitter(self, emitter: ProtectedEventEmitter) -> Self
pub fn with_protected_emitter(self, emitter: ProtectedEventEmitter) -> Self
Set a protected emitter for output processing
Sourcepub fn execution_id(&self) -> &ExecutionId
pub fn execution_id(&self) -> &ExecutionId
Get the execution ID
Sourcepub fn emitter(&self) -> &EventEmitter
pub fn emitter(&self) -> &EventEmitter
Get the event emitter (from inner runner)
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Check if cancelled
Source§impl ProtectedRunner<InMemoryCheckpointStore>
impl ProtectedRunner<InMemoryCheckpointStore>
Sourcepub fn default_new() -> Self
pub fn default_new() -> Self
Create a new protected runner with in-memory checkpoint store
Auto Trait Implementations§
impl<S> !Freeze for ProtectedRunner<S>
impl<S> !RefUnwindSafe for ProtectedRunner<S>
impl<S> Send for ProtectedRunner<S>
impl<S> Sync for ProtectedRunner<S>
impl<S> Unpin for ProtectedRunner<S>
impl<S> UnsafeUnpin for ProtectedRunner<S>
impl<S> !UnwindSafe for ProtectedRunner<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more