#[repr(C)]pub struct Class(_);
Expand description
A type that represents an Objective-C class.
Implementations§
source§impl Class
impl Class
sourcepub fn get(name: &str) -> Option<&'static Self>
pub fn get(name: &str) -> Option<&'static Self>
Returns the class definition of a specified class, or None
if the
class is not registered with the Objective-C runtime.
sourcepub fn classes_count() -> usize
pub fn classes_count() -> usize
Returns the total number of registered classes.
sourcepub fn superclass(&self) -> Option<&Class>
pub fn superclass(&self) -> Option<&Class>
Returns the superclass of self, or None
if self is a root class.
sourcepub fn instance_size(&self) -> usize
pub fn instance_size(&self) -> usize
Returns the size of instances of self.
sourcepub fn instance_method(&self, sel: Sel) -> Option<&Method>
pub fn instance_method(&self, sel: Sel) -> Option<&Method>
Returns a specified instance method for self, or None
if self and
its superclasses do not contain an instance method with the specified
selector.
sourcepub fn instance_variable(&self, name: &str) -> Option<&Ivar>
pub fn instance_variable(&self, name: &str) -> Option<&Ivar>
Returns the ivar for a specified instance variable of self, or
None
if self has no ivar with the given name.
sourcepub fn conforms_to(&self, proto: &Protocol) -> bool
pub fn conforms_to(&self, proto: &Protocol) -> bool
Checks whether this class conforms to the specified protocol.
sourcepub fn responds_to(&self, sel: Sel) -> bool
pub fn responds_to(&self, sel: Sel) -> bool
Check whether instances of this class respond to the given selector.
This doesn’t call respondsToSelector:
, but works entirely within the
runtime, which means it’ll always be safe to call, but may not return
exactly what you’d expect if respondsToSelector:
has been
overwritten.
That said, it will always return true
if an instance of the class
responds to the selector, but may return false
if they don’t
directly (e.g. does so by using forwarding instead).