[][src]Crate fruitbasket

fruitbasket - Framework for running Rust programs in a Mac 'app bundle' environment.

fruitbasket provides two different (but related) services for helping you run your Rust binaries as native AppKit/Cocoa applications on Mac OS X:

The primary goal of fruitbasket is to make it reasonably easy to develop native Mac GUI applications with the standard Apple AppKit/Cocoa/Foundation frameworks in pure Rust by pushing all of the Apple and Objective-C runtime logic into dedicated libraries, isolating the logic of a Rust binary application from the unsafe platform code. As the ecosystem of Mac libraries for Rust grows, you should be able to mix-and-match the libraries your application needs, pump the event loop with fruitbasket, and never worry about Objective-C in your application.

Getting Started

You likely want to create either a Trampoline or a FruitApp right after your Rust application starts. If uncertain, use a Trampoline. You can hit very strange behavior when running Cocoa apps outside of an app bundle.

Structs

FruitApp

Main interface for controlling and interacting with the AppKit app

FruitStopper

An opaque, thread-safe object that can interrupt the run loop.

Trampoline

API to move the executable into a Mac app bundle and relaunch (if necessary)

Enums

ActivationPolicy

Policies controlling how a Mac application's UI is interacted with

FruitCallbackKey

Key into the ObjC callback hash map

FruitError

Class for errors generated by fruitbasket. Dereferences to a String.

InstallDir

Options for where to save generated app bundle

LogDir

Options for where to save logging output generated by fruitbasket

RunPeriod

Options for how long to run the event loop on each call

Constants

DEFAULT_PLIST

Info.plist entries that have default values, but can be overridden

FORBIDDEN_PLIST

Info.plist entries that are set, and cannot be overridden

kAEGetURL

Apple kAEGetURL constant

kInternetEventClass

Apple kInternetEventClass constant

keyDirectObject

Apple keyDirectObject constant

Functions

create_logger

Enable logging to rolling log files with Rust log library

parse_url_event

Parse an Apple URL event into a URL string

Type Definitions

FruitObjcCallback

A boxed Fn type for receiving Rust callbacks from ObjC events