Skip to main content

Module stream

Module stream 

Source
Expand description

Public entry point for streaming typed events from an MTG Arena log file.

MtgaEventStream wires together the file tailer, router, and event bus into a single async fn that returns a Subscriber of typed GameEvent values. It runs entirely on the caller’s Tokio runtime – no internal runtime is created.

§Example

use std::path::Path;
use manasight_parser::stream::MtgaEventStream;

let (stream, mut subscriber) = MtgaEventStream::start(Path::new("Player.log")).await?;

// Receive events on the caller's runtime.
while let Some(event) = subscriber.recv().await {
    println!("got event: {event:?}");
}

§Shutdown

Call MtgaEventStream::shutdown to stop the background tailing task. The Subscriber will receive None once all buffered events have been delivered.

Structs§

MtgaEventStream
Handle for a running MTG Arena event stream.

Enums§

StreamError
Errors that can occur when starting the event stream.