#[repr(C)]pub struct Object(_);
Expand description
A type that represents an instance of a class.
Note: This is intentionally neither Sync
, Send
, UnwindSafe
,
RefUnwindSafe
nor Unpin
, since it is something that changes
depending on the specific subclass.
Examples: NSAutoreleasePool
is not Send
, it has to be deallocated
on the same thread that it was created. NSLock
is not Send
either.
Implementations
sourceimpl Object
impl Object
sourcepub unsafe fn ivar<T: Encode>(&self, name: &str) -> &T
pub unsafe fn ivar<T: Encode>(&self, name: &str) -> &T
Returns a shared reference to the ivar with the given name.
Panics
Panics if the object has no ivar with the given name, or the type
encoding of the ivar differs from the type encoding of T
.
Safety
The caller must ensure that the ivar is actually of type T
.
Library implementors should expose a safe interface to the ivar.
sourcepub unsafe fn get_ivar<T: Encode>(&self, name: &str) -> &T
👎 Deprecated: Use Object::ivar
instead.
pub unsafe fn get_ivar<T: Encode>(&self, name: &str) -> &T
Use Object::ivar
instead.
sourcepub unsafe fn ivar_mut<T: Encode>(&mut self, name: &str) -> &mut T
pub unsafe fn ivar_mut<T: Encode>(&mut self, name: &str) -> &mut T
Returns a mutable reference to the ivar with the given name.
Panics
Panics if the object has no ivar with the given name, or the type
encoding of the ivar differs from the type encoding of T
.
Safety
The caller must ensure that the ivar is actually of type T
.
Library implementors should expose a safe interface to the ivar.
sourcepub unsafe fn get_mut_ivar<T: Encode>(&mut self, name: &str) -> &mut T
👎 Deprecated: Use Object::ivar_mut
instead.
pub unsafe fn get_mut_ivar<T: Encode>(&mut self, name: &str) -> &mut T
Use Object::ivar_mut
instead.
sourcepub unsafe fn set_ivar<T: Encode>(&mut self, name: &str, value: T)
pub unsafe fn set_ivar<T: Encode>(&mut self, name: &str, value: T)
Sets the value of the ivar with the given name.
Panics
Panics if the object has no ivar with the given name, or the type
encoding of the ivar differs from the type encoding of T
.
Safety
The caller must ensure that the ivar is actually of type T
.
Library implementors should expose a safe interface to the ivar.
Trait Implementations
sourceimpl RefEncode for Object
impl RefEncode for Object
sourceconst ENCODING_REF: Encoding<'static> = Encoding::Object
const ENCODING_REF: Encoding<'static> = Encoding::Object
The Objective-C type-encoding for a reference of this type. Read more
impl Message for Object
Auto Trait Implementations
impl !RefUnwindSafe for Object
impl !Send for Object
impl !Sync for Object
impl !Unpin for Object
impl !UnwindSafe for Object
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more