pub struct Operation<T> { /* private fields */ }Expand description
A handle to a running long operation (Markdown/HTML import, DOCX export).
Provides typed access to progress, cancellation, and the result.
Progress events are also emitted via DocumentEvent::LongOperationProgress
and DocumentEvent::LongOperationFinished
for the callback/polling path.
Retrieve the result via wait() (blocking, consumes the handle)
or try_result() (non-blocking, can be called repeatedly).
Implementations§
Source§impl<T> Operation<T>
impl<T> Operation<T>
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
The operation ID (for matching with DocumentEvent variants).
Sourcepub fn progress(&self) -> Option<(f64, String)>
pub fn progress(&self) -> Option<(f64, String)>
Get the current progress, if available.
Returns (percent, message) where percent is 0.0–100.0.
Sourcepub fn wait(self) -> Result<T>
pub fn wait(self) -> Result<T>
Block the calling thread until the operation completes and return the typed result. Consumes the handle.
Sourcepub fn wait_timeout(self, timeout: Duration) -> Option<Result<T>>
pub fn wait_timeout(self, timeout: Duration) -> Option<Result<T>>
Block until the operation completes or the timeout expires.
Returns None if the timeout elapsed before the operation finished.
Sourcepub fn try_result(&mut self) -> Option<Result<T>>
pub fn try_result(&mut self) -> Option<Result<T>>
Non-blocking: returns the result if the operation has completed,
None if still running. Can be called repeatedly.