Skip to main content

OneArgBlock

Type Alias OneArgBlock 

Source
pub type OneArgBlock = RcBlock<Box<dyn Fn(*mut c_void) + Send>>;
Expand description

Block type: void (^)(id)

Used for callbacks with one object argument (e.g., CommandBuffer handlers).

Aliased Type§

pub struct OneArgBlock { /* private fields */ }

Implementations§

Source§

impl OneArgBlock

Source

pub fn from_fn<F>(f: F) -> Self
where F: Fn(*mut c_void) + Send + 'static,

Create a block from a closure taking one pointer argument.

Source

pub fn from_fn_heap<F>(f: F) -> HeapOneArgBlock
where F: Fn(*mut c_void) + Send + 'static,

Create a heap-allocated block from a closure taking one pointer argument.

Use this for blocks that need to outlive the current scope, such as completion handlers passed to Metal APIs.