Skip to main content

Operation

Struct Operation 

Source
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>

Source

pub fn id(&self) -> &str

The operation ID (for matching with DocumentEvent variants).

Source

pub fn progress(&self) -> Option<(f64, String)>

Get the current progress, if available. Returns (percent, message) where percent is 0.0–100.0.

Source

pub fn is_done(&self) -> bool

Returns true if the operation has finished (success or failure).

Source

pub fn cancel(&self)

Cancel the operation. No-op if already finished.

Source

pub fn wait(self) -> Result<T>

Block the calling thread until the operation completes and return the typed result. Consumes the handle.

Source

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.

Source

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.

Auto Trait Implementations§

§

impl<T> Freeze for Operation<T>

§

impl<T> !RefUnwindSafe for Operation<T>

§

impl<T> Send for Operation<T>

§

impl<T> !Sync for Operation<T>

§

impl<T> Unpin for Operation<T>

§

impl<T> UnsafeUnpin for Operation<T>

§

impl<T> !UnwindSafe for Operation<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.