Skip to main content

ArcTraceDispatcher

Type Alias ArcTraceDispatcher 

Source
pub type ArcTraceDispatcher = Arc<dyn TraceDispatcher + Send + Sync>;
Expand description

Type alias for an atomically reference-counted trace dispatcher.

This is the standard way to share a TraceDispatcher implementation across multiple threads or components. The Arc provides thread-safe reference counting.

§Thread Safety

ArcTraceDispatcher is both Send and Sync, allowing it to be safely shared across thread boundaries and accessed concurrently from multiple threads.

§Examples

ⓘ
use std::sync::Arc;
use crate::trace::trace_dispatcher::{TraceDispatcher, ArcTraceDispatcher};
use crate::trace::async_trace_dispatcher::AsyncTraceDispatcher;

// Create a dispatcher
let dispatcher = AsyncTraceDispatcher::new("ProducerGroup", Type::Produce, "TraceTopic", None);
let arc_dispatcher: ArcTraceDispatcher = Arc::new(dispatcher);

// Share across threads
let dispatcher_clone = arc_dispatcher.clone();

Aliased Type§

pub struct ArcTraceDispatcher { /* private fields */ }