Skip to main content

cast_class

Function cast_class 

Source
pub unsafe fn cast_class(
    object: *const c_void,
    target: *const c_void,
) -> Option<*const c_void>
Expand description

Cast a class reference to another class, or None.

object as? SomeClass for the class-to-class case, which has its own entry point because it needs no value buffer — a class reference is one word, and the answer is the same word or nothing.

§Safety

object must be a live Swift or Objective-C class instance and target class metadata.