[go: up one dir, main page]

Struct block2::RcBlock

source ·
pub struct RcBlock<A, R> { /* private fields */ }
Expand description

A reference-counted Objective-C block.

Implementations§

source§

impl<A, R> RcBlock<A, R>

source

pub unsafe fn new(ptr: *mut Block<A, R>) -> Self

Construct an RcBlock for the given block without copying it. The caller must ensure the block has a +1 reference count.

Safety

The given pointer must point to a valid Block and must have a +1 reference count or it will be overreleased when the RcBlock is dropped.

source

pub unsafe fn copy(ptr: *mut Block<A, R>) -> Self

Constructs an RcBlock by copying the given block.

Safety

The given pointer must point to a valid Block.

Methods from Deref<Target = Block<A, R>>§

source

pub unsafe fn call(&self, args: A) -> R

Call self with the given arguments.

Safety

This invokes foreign code that the caller must verify doesn’t violate any of Rust’s safety rules.

For example, if this block is shared with multiple references, the caller must ensure that calling it will not cause a data race.

Trait Implementations§

source§

impl<A, R> Clone for RcBlock<A, R>

source§

fn clone(&self) -> RcBlock<A, R>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<A, R> Debug for RcBlock<A, R>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<A, R> Deref for RcBlock<A, R>

§

type Target = Block<A, R>

The resulting type after dereferencing.
source§

fn deref(&self) -> &Block<A, R>

Dereferences the value.
source§

impl<A, R> Drop for RcBlock<A, R>

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<A, R> !RefUnwindSafe for RcBlock<A, R>

§

impl<A, R> !Send for RcBlock<A, R>

§

impl<A, R> !Sync for RcBlock<A, R>

§

impl<A, R> Unpin for RcBlock<A, R>

§

impl<A, R> !UnwindSafe for RcBlock<A, R>

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where 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 T
where 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.
source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,