pub struct EffectGate { /* private fields */ }Expand description
The single admission authority for one control surface. Cheap to share
behind an Arc; admit is safe to call concurrently.
Implementations§
Source§impl EffectGate
impl EffectGate
pub fn new(hook: impl AdmissionHook + 'static) -> Self
pub fn from_arc(hook: Arc<dyn AdmissionHook>) -> Self
pub fn with_events(self, sink: EventSink) -> Self
Sourcepub fn with_journal_capacity(self, capacity: usize) -> Self
pub fn with_journal_capacity(self, capacity: usize) -> Self
Bound on retained settlements (oldest dropped first). 0 keeps none.
Sourcepub fn settlements(&self) -> Vec<Settlement>
pub fn settlements(&self) -> Vec<Settlement>
Snapshot of retained settlements, oldest first.
Sourcepub fn admit<T>(
&self,
request: EffectRequest,
cancel: &CancelToken,
execute: impl FnOnce(&CancelToken) -> Result<T, ExecError>,
) -> Effect<T>
pub fn admit<T>( &self, request: EffectRequest, cancel: &CancelToken, execute: impl FnOnce(&CancelToken) -> Result<T, ExecError>, ) -> Effect<T>
Run request through validate → approval → execute → settle.
execute is invoked at most once, and only when validation and the
hook both admit the request and cancel is not yet set. Every path
settles exactly once (recorded and returned) and emits lifecycle
events. Executor panics are contained and settled as Failed.
Trait Implementations§
Source§impl Debug for EffectGate
impl Debug for EffectGate
Auto Trait Implementations§
impl !Freeze for EffectGate
impl !RefUnwindSafe for EffectGate
impl !UnwindSafe for EffectGate
impl Send for EffectGate
impl Sync for EffectGate
impl Unpin for EffectGate
impl UnsafeUnpin for EffectGate
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