pub struct RunningIperf { /* private fields */ }Expand description
Handle for an iperf run executing on a worker thread.
This handle observes completion; it does not own a safe cancellation
mechanism for the underlying libiperf run. Dropping it detaches the worker.
try_wait, wait_timeout, and wait only observe or join the worker; none
of them requests libiperf shutdown. Use one-off server mode or a dedicated
helper process when a run must be externally stopped, isolated from hangs, or
allowed to coexist with other runs in the parent process.
Implementations§
Source§impl RunningIperf
impl RunningIperf
Sourcepub fn metrics(&self) -> Option<&MetricsStream>
pub fn metrics(&self) -> Option<&MetricsStream>
Borrow the live metric stream, if metrics were enabled.
Sourcepub fn take_metrics(&mut self) -> Option<MetricsStream>
pub fn take_metrics(&mut self) -> Option<MetricsStream>
Take ownership of the live metric stream.
Sourcepub fn is_finished(&self) -> bool
pub fn is_finished(&self) -> bool
Return true if the worker thread has finished.
Sourcepub fn try_wait(&mut self) -> Result<Option<IperfResult>>
pub fn try_wait(&mut self) -> Result<Option<IperfResult>>
Return the result if the worker has finished, without blocking.
After this returns Ok(Some(_)), the worker result has been consumed and
later calls to try_wait, wait_timeout, or wait will report that the
run was already observed.
Sourcepub fn wait_timeout(&mut self, timeout: Duration) -> Result<Option<IperfResult>>
pub fn wait_timeout(&mut self, timeout: Duration) -> Result<Option<IperfResult>>
Wait up to timeout for the worker to finish.
Returns Ok(None) when the timeout expires before the iperf run exits.
A zero timeout performs a single nonblocking poll. Timeout expiration
does not stop the iperf run; call this again, call RunningIperf::wait,
or manage cancellation outside this in-process API.
Sourcepub fn wait(self) -> Result<IperfResult>
pub fn wait(self) -> Result<IperfResult>
Wait until the iperf worker exits.