Skip to main content

ScopedEmitter

Struct ScopedEmitter 

Source
pub struct ScopedEmitter { /* private fields */ }
Expand description

Run-scoped event emitter. Subsystems (tools, memory, middleware) receive one of these so they don’t need to know about run_id or the monotonic seq counter — they just call .emit(span_id, kind).

The plan’s context types show events: Arc<dyn EventSink> alone; in practice the envelope needs a seq and run_id that the loop owns. This wrapper closes that gap without changing the EventSink trait.

Implementations§

Source§

impl ScopedEmitter

Source

pub fn new(sink: Arc<dyn EventSink>, run_id: RunId, seq: Arc<AtomicU64>) -> Self

Source

pub fn sink(&self) -> &Arc<dyn EventSink>

Source

pub fn run_id(&self) -> RunId

Source

pub fn next_seq(&self) -> u64

Source

pub fn emit( &self, span_id: impl Into<SpanId>, kind: EventKind, parent: Option<u64>, ) -> u64

Build and emit a stamped event (blocks on backpressure per EventSink::emit). Returns the event’s seq so spans can be linked.

Source

pub fn try_emit( &self, span_id: impl Into<SpanId>, kind: EventKind, parent: Option<u64>, ) -> Result<u64, u64>

Non-blocking emit. On backpressure, the event is dropped and Err(seq) is returned so the caller can log or retry.

Trait Implementations§

Source§

impl Clone for ScopedEmitter

Source§

fn clone(&self) -> ScopedEmitter

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.