https://github.com/michaelwu/RustKit
Fast and ergonomic Rust bindings for ObjC APIs
https://github.com/michaelwu/RustKit
rust rust-bindings
Last synced: about 1 year ago
JSON representation
Fast and ergonomic Rust bindings for ObjC APIs
- Host: GitHub
- URL: https://github.com/michaelwu/RustKit
- Owner: michaelwu
- License: apache-2.0
- Created: 2018-06-30T16:01:59.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-03T18:14:15.000Z (over 7 years ago)
- Last Synced: 2024-10-31T11:51:56.639Z (over 1 year ago)
- Topics: rust, rust-bindings
- Language: Rust
- Homepage:
- Size: 50.8 KB
- Stars: 154
- Watchers: 7
- Forks: 8
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# 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](https://reviews.llvm.org/D50318) 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);
}
```