Struct libpulse_binding::operation::Operation [−][src]
pub struct Operation { /* fields omitted */ }
An asynchronous operation object. This acts as a safe Rust wrapper for the actual C object. Note: Saves a copy of active multi-use closure callbacks, which it frees on drop.
Methods
impl Operation
[src]
impl Operation
pub fn cancel(&mut self)
[src]
pub fn cancel(&mut self)
Cancel 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, cancelling operations with single-use callbacks (those that are fired only once) will result in a memory leak. (In such cases the closure is transferred to the callback via a raw pointer, and when the callback is fired, it is reconstructed and dropped after use; cancelling callback execution means this will not happen, thus a leak occurs).
pub fn get_state(&self) -> State
[src]
pub fn get_state(&self) -> State
Return the current status of the operation
pub fn set_state_callback(&mut self, callback: Option<Box<FnMut() + 'static>>)
[src]
pub fn set_state_callback(&mut self, callback: Option<Box<FnMut() + 'static>>)
Set 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.