#bindings-generator #obj-c #api #rustkit #rust-kit

deprecated rustkit_bindgen

The bindings generator used by RustKit

1 unstable release

Uses old Rust 2015

0.0.1 Aug 24, 2018

#163 in #bindings-generator


Used in rustkit

Apache-2.0/MIT

120KB
3K SLoC

RustKit

Fast and ergonomic Rust bindings for ObjC APIs

RustKit is currently under development. Please try it if you want to contribute or provide feedback on the generated bindings.

Prerequisites

Clang 8.0 (currently trunk) with a patch is currently required. Build clang and set the LIBCLANG_PATH environmental variable to the directory that libclang.dylib is in, which should be in the lib directory of your clang/llvm build directory.

Example

extern crate rustkit;

use rustkit::NSObject;

fn main() {
    let obj = NSObject::new();
    
    let desc = NSObject::description();
    let desc = desc.unwrap();
    let desclen = desc.length();
    let ruststr: String =
        (0..desclen).map(|i|
                         std::char::from_u32(desc.characterAtIndex_(i) as u32).
                         unwrap()).collect();
    println!("NSObject::description(): {}", ruststr);
}

Dependencies

~2.5MB
~54K SLoC