pub struct DriverRunner { /* private fields */ }Expand description
Runs a Driver on its own background thread — the Driver analog of
crate::pipeline::Pipeline, minus everything that only makes sense
for a dataflow graph (Clock, Pause, Seek, the wire callback).
run() is asynchronous, same as Pipeline::run: it starts the driver
on a background thread and returns immediately. Watch
DriverRunner::bus to learn when it’s actually done — draining it
blocks until every Bus sender has been dropped. The built-in drivers
keep that sender only for the duration of their background run call,
so this normally coincides with thread completion; a custom Driver
that clones and retains bus extends the wait until its clone drops.
Implementations§
Source§impl DriverRunner
impl DriverRunner
pub fn new(driver: impl Driver + 'static) -> Arc<Self> ⓘ
pub fn bus(&self) -> &BusReceiver
Sourcepub fn run(self: &Arc<Self>)
pub fn run(self: &Arc<Self>)
Starts driving the task on a background thread and returns
immediately. A no-op if this DriverRunner is already running or
has already finished a previous run — same posture as
crate::pipeline::Pipeline::run, not reusable afterward.
Sourcepub fn stop(&self)
pub fn stop(&self)
Requests an early stop — see StopReceiver’s own docs for why
this never blocks. A no-op if run() isn’t currently in progress.
Trait Implementations§
Source§impl Drop for DriverRunner
impl Drop for DriverRunner
Source§fn drop(&mut self)
fn drop(&mut self)
Same posture as crate::pipeline::Pipeline’s own Drop: dropping
the last handle stops the background work instead of leaking it.
Sets the flag directly rather than through stop() — by the time
this runs there’s no Arc<Self> left to reach &self through one,
only the raw fields still being torn down.