pub struct Operation<ClosureProto: ?Sized> { /* private fields */ }
Expand description

An asynchronous operation object.

Note: Saves a copy of active multi-use closure callbacks, which it frees on drop.

Implementations§

source§

impl<ClosureProto: ?Sized> Operation<ClosureProto>

source

pub fn cancel(&mut self)

Cancels the operation.

Beware! This will not necessarily cancel the execution of the operation on the server side. However it will make sure that the callback associated with this operation will not be called any more, effectively disabling the operation from the client side’s view.

Warning, you should never attempt to use this to cancel a callback from within the execution of that callback itself. This should go without saying, since it makes absolutely no sense to try and do this, but be aware that this is not supported by the C API and will break things.

source

pub fn get_state(&self) -> State

Gets the current status of the operation.

source

pub fn set_state_callback( &mut self, callback: Option<Box<dyn FnMut() + 'static>> )

Sets the callback function that is called when the operation state changes.

Usually this is not necessary, since the functions that create Operation objects already take a callback that is called when the operation finishes. Registering a state change callback is mainly useful, if you want to get called back also if the operation gets cancelled.

Trait Implementations§

source§

impl<ClosureProto: ?Sized> Drop for Operation<ClosureProto>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl<ClosureProto: ?Sized> Send for Operation<ClosureProto>

source§

impl<ClosureProto: ?Sized> Sync for Operation<ClosureProto>

Auto Trait Implementations§

§

impl<ClosureProto> !RefUnwindSafe for Operation<ClosureProto>

§

impl<ClosureProto: ?Sized> Unpin for Operation<ClosureProto>

§

impl<ClosureProto> !UnwindSafe for Operation<ClosureProto>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.