#[repr(C)]pub struct Class { /* private fields */ }
Expand description
An Objective-C class.
See documentation.
Usage
This is an opaque type meant to be used behind a shared reference &Class
,
which is semantically equivalent to Class _Nonnull
.
A nullable class is defined as Option<&Class>
, which is semantically
equivalent to Class _Nullable
.
Implementations
sourceimpl Class
impl Class
sourcepub fn get(name: &CStr) -> Option<&'static Class>
pub fn get(name: &CStr) -> Option<&'static Class>
Returns the class definition of a specified class, or None
if the
class is not registered with the Objective-C runtime.
sourcepub fn all() -> Vec<&'static Class>
pub fn all() -> Vec<&'static Class>
Returns all classes registered with the Objective-C runtime.
sourcepub fn responds_to_selector(&self, selector: Sel) -> bool
pub fn responds_to_selector(&self, selector: Sel) -> bool
Returns true
if this class implements or inherits a method that can
respond to a specified message.
See documentation.
sourcepub fn instances_respond_to_selector(&self, selector: Sel) -> bool
pub fn instances_respond_to_selector(&self, selector: Sel) -> bool
Returns true
if instances of this class implement or inherit a method
that can respond to a specified message.
See documentation.
sourcepub fn superclass(&self) -> Option<&Class>
pub fn superclass(&self) -> Option<&Class>
Returns this class’s superclass, or None
if this is a root class
(e.g. NSObject
).
sourcepub fn superclass_iter(&self) -> impl Iterator<Item = &Class> + Copy
pub fn superclass_iter(&self) -> impl Iterator<Item = &Class> + Copy
Returns an iterator over the superclasses of this class.
sourcepub fn superclass_count(&self) -> usize
pub fn superclass_count(&self) -> usize
Returns the number of superclasses of this class.
sourcepub fn is_subclass(&self) -> bool
pub fn is_subclass(&self) -> bool
Returns true
if this class has a superclass.
sourcepub fn is_subclass_of(&self, other: &Self) -> bool
pub fn is_subclass_of(&self, other: &Self) -> bool
Returns true
if this class is a subclass of, or identical to, the
other class.
sourcepub fn instance_size(&self) -> usize
pub fn instance_size(&self) -> usize
Returns the size of instances of this class.
sourcepub fn get_class_method(&self, name: Sel) -> Option<&Method>
pub fn get_class_method(&self, name: Sel) -> Option<&Method>
Returns a reference to the data for a class method defined by name
, or
None
if this class or its superclasses do not implement a class method
with the specified selector.
Note that this function searches superclasses for implementations,
whereas copy_class_method_list
does
not.
See documentation.
sourcepub fn copy_class_method_list(&self) -> Option<Malloced<[&Method]>>
pub fn copy_class_method_list(&self) -> Option<Malloced<[&Method]>>
Returns the class methods implemented by this class, or None
if this
class implements no instance methods.
To get the implementations of instance methods that may be implemented
by superclasses, use get_class_method
.
This calls
class_copyMethodList
on the metaclass of this class.
sourcepub fn get_instance_method(&self, name: Sel) -> Option<&Method>
pub fn get_instance_method(&self, name: Sel) -> Option<&Method>
Returns a reference to the data for an instance method defined by
name
, or None
if this class or its superclasses do not implement an
instance method with the specified selector.
Note that this function searches superclasses for implementations,
whereas copy_instance_method_list
does not.
See documentation.
sourcepub fn copy_instance_method_list(&self) -> Option<Malloced<[&Method]>>
pub fn copy_instance_method_list(&self) -> Option<Malloced<[&Method]>>
Returns the instance methods implemented by this class, or None
if
this class implements no instance methods.
To get the implementations of instance methods that may be implemented
by superclasses, use get_instance_method
.
See documentation
.
sourcepub fn get_property<'a>(&'a self, name: &CStr) -> Option<&'a Property>
pub fn get_property<'a>(&'a self, name: &CStr) -> Option<&'a Property>
Returns a property of self
with name
.
See documentation.
sourcepub fn copy_property_list(&self) -> Option<Malloced<[&Property]>>
pub fn copy_property_list(&self) -> Option<Malloced<[&Property]>>
Returns a malloc
-ed list of properties declared by self
.
Any properties declared by superclasses are not included.
See documentation.
Trait Implementations
sourceimpl Ord for Class
impl Ord for Class
sourceimpl PartialOrd<Class> for Class
impl PartialOrd<Class> for Class
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Class
impl RefUnwindSafe for Class
impl Send for Class
impl Sync for Class
Auto Trait Implementations
impl Unpin for Class
impl UnwindSafe for Class
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