sys yaslapi-sys

A library that provides bindings to the Yet Another Scripting Language (YASL) API

8 releases

0.2.5 Feb 18, 2024
0.2.4 Feb 18, 2024
0.2.3 Sep 4, 2023
0.2.0 Apr 2, 2023
0.1.1 Apr 2, 2023

47 downloads per month
Used in yaslapi

MIT license

465KB
14K SLoC

C 14K SLoC // 0.0% comments Alex 214 SLoC Shell 149 SLoC // 0.0% comments Rust 60 SLoC // 0.2% comments Python 8 SLoC

yaslapi-sys

yaslapi-sys is a Rust library that provides raw bindings to the Yet Another Scripting Language (YASL) API.

Installation

First, you must have CMake and a C compiler installed so that YASL can be compiled locally. To install yaslapi-sys, add the following to your Cargo.toml file:

[dependencies]
yaslapi-sys = "0.2.4"

Then run cargo build to build your project.

Usage

Here’s an example of how to use yaslapi-sys in your Rust code:

use yaslapi_sys::YASL_State;
use std::ffi::CString;

fn main() {
    const SRC: &str = "let x = 5; echo x**x;";
    let state: *mut YASL_State = unsafe { yaslapi_sys::YASL_newstate_bb(SRC.as_ptr().cast(), SRC.len()) };
    assert!(!state.is_null());
    // ...
}

License

yaslapi-sys is licensed under the MIT License.


lib.rs:

yaslapi-sys

yaslapi-sys is a Rust library that provides raw bindings to the Yet Another Scripting Language (YASL) API.

Then run cargo build to build your project.

Usage

Here’s an example of how to use yaslapi-sys in your Rust code:

use yaslapi_sys::YASL_State;
use std::ffi::CString;

const SRC: &str = "let x = 5; echo x**x;";
let state: *mut YASL_State = unsafe { yaslapi_sys::YASL_newstate_bb(SRC.as_ptr().cast(), SRC.len()) };
assert!(!state.is_null());

No runtime deps

~0–2.2MB
~44K SLoC