Trait DispatchObject

Source
pub unsafe trait DispatchObject {
    // Provided methods
    fn retain(&self) -> DispatchRetained<Self>  { ... }
    fn context(&self) -> *mut c_void { ... }
    unsafe fn set_context(&self, context: *mut c_void) { ... }
    unsafe fn set_finalizer_f(&self, finalizer: dispatch_function_t) { ... }
    fn set_finalizer<F>(&self, destructor: F)
       where F: Send + FnOnce() { ... }
    unsafe fn set_target_queue(&self, queue: &DispatchQueue) { ... }
    unsafe fn set_qos_class_floor(
        &self,
        qos_class: DispatchQoS,
        relative_priority: i32,
    ) -> Result<(), QualityOfServiceClassFloorError> { ... }
    fn activate(&self) { ... }
    fn suspend(&self) { ... }
    fn resume(&self) { ... }
}
Expand description

Types that represent dispatch objects.

§Safety

The object must represent a dispatch object, and be usable in dispatch_retain / dispatch_release.

Provided Methods§

Source

fn retain(&self) -> DispatchRetained<Self>

Increment the reference count of the object.

This extends the duration in which the object is alive by detaching it from the lifetime information carried by the reference.

Source

fn context(&self) -> *mut c_void

TODO.

§Safety

TODO.

Source

unsafe fn set_context(&self, context: *mut c_void)

TODO.

§Safety

TODO.

Source

unsafe fn set_finalizer_f(&self, finalizer: dispatch_function_t)

TODO.

§Safety

TODO.

Source

fn set_finalizer<F>(&self, destructor: F)
where F: Send + FnOnce(),

Set the finalizer function for the object.

Source

unsafe fn set_target_queue(&self, queue: &DispatchQueue)

Set the target DispatchQueue of this object.

§Aborts

Aborts if the object has been activated.

§Safety
  • There must not be a cycle in the hierarchy of queues.
Source

unsafe fn set_qos_class_floor( &self, qos_class: DispatchQoS, relative_priority: i32, ) -> Result<(), QualityOfServiceClassFloorError>

Set the QOS class floor on a dispatch queue, source or workloop.

§Safety
  • DispatchObject should be a queue or queue source.
Source

fn activate(&self)

Activate the object.

Source

fn suspend(&self)

Suspend the invocation of functions on the object.

Source

fn resume(&self)

Resume the invocation of functions on the object.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§