#[repr(transparent)]
pub struct Sel { /* private fields */ }
Expand description

A method selector.

The Rust equivalent of Objective-C’s SEL type. You can easily create this using the sel! macro.

The main reason the Objective-C runtime uses a custom types for selectors is to support efficient comparison - a selector is effectively just an interned string, so this makes that very easy!

This guarantees the null-pointer optimization, namely that Option<Sel> is the same size as Sel.

Implementations

Get a pointer to the raw selector.

Useful when working with raw FFI methods.

Registers a selector with the Objective-C runtime.

This is the dynamic version of the sel! macro, prefer to use that when your selector is static.

Panics

Panics if name contains an internal NUL byte, or if the runtime failed allocating space for the selector.

Returns the string representation of the selector.

Panics

Panics if the selector is not valid UTF-8 (however unlikely!)

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The Objective-C type-encoding for this type.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. 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

Formats the value using the given formatter.

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 resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

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.