pub struct TraceServer { /* private fields */ }Expand description
The shared trace server. Clone the Arc, not the server.
Implementations§
Source§impl TraceServer
impl TraceServer
Sourcepub fn new(vars: VariableMap) -> Arc<TraceServer>
pub fn new(vars: VariableMap) -> Arc<TraceServer>
Build a server that decodes variables according to vars.
Sourcepub fn subscribe(&self) -> Receiver<String>
pub fn subscribe(&self) -> Receiver<String>
Subscribe to the JSON event stream (one JSON object per message).
Sourcepub fn ingest(&self, bytes: &[u8]) -> Vec<TraceEvent>
pub fn ingest(&self, bytes: &[u8]) -> Vec<TraceEvent>
Decode bytes, broadcast the resulting events, and return them (handy
for tests and for callers that want to log locally).
Sourcepub fn flush(&self) -> Vec<TraceEvent>
pub fn flush(&self) -> Vec<TraceEvent>
Emit any buffered partial log line. Call when the source ends.
Sourcepub async fn serve_ws(
self: &Arc<Self>,
addr: &str,
) -> Result<(SocketAddr, JoinHandle<()>)>
pub async fn serve_ws( self: &Arc<Self>, addr: &str, ) -> Result<(SocketAddr, JoinHandle<()>)>
Bind a WebSocket listener on addr and accept clients in the background.
Returns the bound address (useful when addr uses port 0).
Auto Trait Implementations§
impl !Freeze for TraceServer
impl RefUnwindSafe for TraceServer
impl Send for TraceServer
impl Sync for TraceServer
impl Unpin for TraceServer
impl UnsafeUnpin for TraceServer
impl UnwindSafe for TraceServer
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