[][src]Enum fruitbasket::FruitCallbackKey

pub enum FruitCallbackKey {
    Method(&'static str),
    Object(*mut Object),
}

Key into the ObjC callback hash map

You can register to receive callbacks from ObjectiveC based on these keys.

Callbacks that are not tied to objects can be registered with static selector strings. For instance, if your app has registered itself as a URL handler, you would use: FruitCallbackKey::Method("handleEvent:withReplyEvent:")

Other pre-defined selectors are: FruitCallbackKey::Method("applicationWillFinishlaunching:") FruitCallbackKey::Method("applicationDidFinishlaunching:")

The Object variant is currently unused, and reserved for the future. If the callback will be from a particular object, you use the Object type with the ObjC object included. For example, if you want to register for callbacks from a particular NSButton instance, you would add it to the callback map with: let button1: *mut Object = ; app.register_callback(FruitCallbackKey::Object(button), Box::new(|button1| { println!("got callback from button1, address: {:x}", button1 as u64); }));

Variants

Method(&'static str)

A callback tied to a generic selector

Object(*mut Object)

A callback from a specific object instance

Trait Implementations

impl Eq for FruitCallbackKey[src]

impl Hash for FruitCallbackKey[src]

impl PartialEq<FruitCallbackKey> for FruitCallbackKey[src]

impl StructuralEq for FruitCallbackKey[src]

impl StructuralPartialEq for FruitCallbackKey[src]

Auto Trait Implementations

impl RefUnwindSafe for FruitCallbackKey

impl !Send for FruitCallbackKey

impl !Sync for FruitCallbackKey

impl Unpin for FruitCallbackKey

impl UnwindSafe for FruitCallbackKey

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.