Skip to main content

GlobalBlock

Struct GlobalBlock 

Source
pub struct GlobalBlock { /* private fields */ }
Expand description

An Objective-C block with no captures.

A block is an object whose first word is an isa like any other; what makes it callable is the invoke pointer at offset 16, which is passed the block itself as its first argument. With nothing captured there is nothing to copy or release, so the block can be a plain static tagged BLOCK_IS_GLOBAL — _NSConcreteGlobalBlock is exactly the isa for that.

Implementations§

Source§

impl GlobalBlock

Source

pub unsafe fn new( invoke: *const c_void, descriptor: &'static BlockDescriptor, ) -> Self

Wrap invoke as a block. It is called with the block as its first argument, then whatever the block’s signature declares.

§Safety

invoke must match the signature the receiver expects, including the leading block pointer.

Trait Implementations§

Auto Trait Implementations§

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.