#[repr(C)]
pub struct Class(_);
Expand description

A type that represents an Objective-C class.

Implementations

Returns the class definition of a specified class, or None if the class is not registered with the Objective-C runtime.

Available on crate feature malloc only.

Obtains the list of registered class definitions.

Returns the total number of registered classes.

Returns the name of the class.

Returns the superclass of self, or None if self is a root class.

Returns the metaclass of self.

Returns the size of instances of self.

Returns a specified instance method for self, or None if self and its superclasses do not contain an instance method with the specified selector.

Returns the ivar for a specified instance variable of self, or None if self has no ivar with the given name.

Available on crate feature malloc only.

Describes the instance methods implemented by self.

Checks whether this class conforms to the specified protocol.

Available on crate feature malloc only.

Get a list of the protocols to which this class conforms.

Available on crate feature malloc only.

Describes the instance variables declared by self.

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).

Available on crate feature malloc only.

Verify argument and return types for a given selector.

This will look up the encoding of the method for the given selector and return a VerificationError if any encodings differ for the arguments A and return type R.

Example
let cls = class!(NSObject);
let sel = sel!(isKindOfClass:);
// Verify that `isKindOfClass:`:
// - Exists on the class
// - Takes a class as a parameter
// - Returns a BOOL
let result = cls.verify_sel::<(&Class,), bool>(sel);
assert!(result.is_ok());

Trait Implementations

Formats the value using the given formatter. Read more

Feeds this value into the given Hasher. Read more

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

Sends a message to self with the given selector and arguments. Read more

Sends a message to a specific superclass with the given selector and arguments. Read more

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

The Objective-C type-encoding for a reference of this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.