Struct objc_id::Id[][src]

pub struct Id<T, O = Owned> { /* fields omitted */ }

A pointer type for Objective-C's reference counted objects.

The object of an Id is retained and sent a release message when the Id is dropped.

An Id may be either Owned or Shared, represented by the types Id and ShareId, respectively. If owned, there are no other references to the object and the Id can be mutably dereferenced. ShareId, however, can only be immutably dereferenced because there may be other references to the object, but a ShareId can be cloned to provide more references to the object. An owned Id can be "downgraded" freely to a ShareId, but there is no way to safely upgrade back.

Methods

impl<T, O> Id<T, O> where
    T: Message,
    O: Ownership
[src]

Constructs an Id from a pointer to an unretained object and retains it. Panics if the pointer is null. Unsafe because the pointer must be to a valid object and the caller must ensure the ownership is correct.

Constructs an Id from a pointer to a retained object; this won't retain the pointer, so the caller must ensure the object has a +1 retain count. Panics if the pointer is null. Unsafe because the pointer must be to a valid object and the caller must ensure the ownership is correct.

impl<T> Id<T, Owned> where
    T: Message
[src]

"Downgrade" an owned Id to a ShareId, allowing it to be cloned.

Trait Implementations

impl<T> Clone for Id<T, Shared> where
    T: Message
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<T, O> Sync for Id<T, O> where
    T: Sync
[src]

impl<T> Send for Id<T, Owned> where
    T: Send
[src]

impl<T> Send for Id<T, Shared> where
    T: Sync
[src]

impl<T, O> Deref for Id<T, O>
[src]

The resulting type after dereferencing.

Dereferences the value.

impl<T> DerefMut for Id<T, Owned>
[src]

Mutably dereferences the value.

impl<T, O> PartialEq for Id<T, O> where
    T: PartialEq
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<T, O> Eq for Id<T, O> where
    T: Eq
[src]

impl<T, O> Hash for Id<T, O> where
    T: Hash
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl<T, O> Debug for Id<T, O> where
    T: Debug
[src]

Formats the value using the given formatter. Read more

impl<T, O> Pointer for Id<T, O>
[src]

Formats the value using the given formatter.

Auto Trait Implementations

impl<T, O = Owned> !Send for Id<T, O>