osakit
osakit aims to provide direct access to OSAKit Framework of macOS. Is uses ObjC-bindings
to access OSAKit and run both AppleScript and JavaScript.
osakit is built using serde for input-output
serialization/deserialization.
Allows passing data to JavaScript/AppleScript functions and returns back the results.
Input and output data are represented using Value from
serde_json.
Comes with declare_script! macro (unstable) to simplify working with OSAKit Framework.
Installation
Add osakit to the dependencies. Specify "full" feature if you want to use declare_script
macro or "stable" feature to only include stable API.
[]
= { = "0.2", = ["full"] }
Example using declare_script
use ;
use declare_script;
use Error;
declare_script!
Example using Script
use ;
use Error;
Usage
See Full Documentation.
Limitations
- Due to limitations on
OSAKit Framework-side integer values returned fromJavaScriptcode are limited toi32type. OSAKitcalls must be made from the main thread, so, for example, the defaultcargo tests can fail, after stalling for 2 min, use a custom test harness like libtest-mimic with--test-threads=1. For convenience, there is a libtest-mimic-collect crate that provides a procedural macro for collecting tests forlibtest-mimiccrate.
Supported platforms
Due to the fact that OSAKit is Mac-specific, only macOS is supported.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.