pub struct ProtectedEventEmitter { /* private fields */ }Expand description
Protected Event Emitter
Wraps EventEmitter with output processor pipeline. All events pass through protection before being added to the stream.
§Usage
ⓘ
use enact_core::streaming::{ProtectedEventEmitter, PiiProtectionProcessor};
let emitter = ProtectedEventEmitter::new()
.with_processor(Arc::new(PiiProtectionProcessor::new()))
.with_context(ProtectionContext::for_stream());Implementations§
Source§impl ProtectedEventEmitter
impl ProtectedEventEmitter
Sourcepub fn with_mode(mode: StreamMode) -> Self
pub fn with_mode(mode: StreamMode) -> Self
Create with a specific stream mode
Sourcepub fn with_processor(self, processor: Arc<dyn OutputProcessor>) -> Self
pub fn with_processor(self, processor: Arc<dyn OutputProcessor>) -> Self
Add a processor to the pipeline
Sourcepub fn with_context(self, context: ProtectionContext) -> Self
pub fn with_context(self, context: ProtectionContext) -> Self
Set the protection context
Sourcepub fn set_context(&mut self, context: ProtectionContext)
pub fn set_context(&mut self, context: ProtectionContext)
Set the protection context (mutable)
Sourcepub fn context(&self) -> &ProtectionContext
pub fn context(&self) -> &ProtectionContext
Get the protection context
Sourcepub async fn emit(&self, event: StreamEvent) -> Result<()>
pub async fn emit(&self, event: StreamEvent) -> Result<()>
Emit an event (runs through protection pipeline)
This is async because processors may need async operations
Sourcepub fn emit_unprotected(&self, event: StreamEvent)
pub fn emit_unprotected(&self, event: StreamEvent)
Emit an event synchronously (bypasses protection pipeline)
Use only for events that are guaranteed safe (control events, etc.)
Sourcepub async fn emit_force(&self, event: StreamEvent) -> Result<()>
pub async fn emit_force(&self, event: StreamEvent) -> Result<()>
Emit an event unconditionally (ignores mode, runs through protection)
Sourcepub fn drain(&self) -> Vec<StreamEvent>
pub fn drain(&self) -> Vec<StreamEvent>
Get all collected events
Sourcepub fn mode(&self) -> StreamMode
pub fn mode(&self) -> StreamMode
Get the current stream mode
Sourcepub fn inner(&self) -> &EventEmitter
pub fn inner(&self) -> &EventEmitter
Get reference to inner emitter (for compatibility)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ProtectedEventEmitter
impl !RefUnwindSafe for ProtectedEventEmitter
impl Send for ProtectedEventEmitter
impl Sync for ProtectedEventEmitter
impl Unpin for ProtectedEventEmitter
impl UnsafeUnpin for ProtectedEventEmitter
impl !UnwindSafe for ProtectedEventEmitter
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