otter-jsc-core

Crates.iootter-jsc-core
lib.rsotter-jsc-core
version0.1.2
created_at2026-01-15 12:36:17.615853+00
updated_at2026-01-15 15:40:54.209324+00
descriptionSafe Rust wrappers for JavaScriptCore
homepagehttps://github.com/octofhir/otter
repositoryhttps://github.com/octofhir/otter
max_upload_size
id2045474
size75,046
Alexander Streltsov (octoshikari)

documentation

README

otter-jsc-core

Safe Rust wrappers for JavaScriptCore.

Overview

This crate provides safe, ergonomic Rust bindings to JavaScriptCore (JSC). It wraps the low-level FFI bindings from otter-jsc-sys with proper memory management and error handling.

Features

  • Safe context and value management
  • Automatic memory management with RAII
  • JSON serialization/deserialization
  • Function callbacks from JavaScript to Rust
  • Property access and manipulation

Usage

use otter_jsc_core::{JscContext, JscValue};

fn main() -> Result<(), otter_jsc_core::JscError> {
    let ctx = JscContext::new()?;

    // Evaluate JavaScript
    let result = ctx.eval("1 + 2")?;
    println!("Result: {}", result.to_number()?);

    // Create values
    let obj = ctx.create_object()?;
    obj.set_property("name", ctx.create_string("Otter")?)?;

    Ok(())
}

Platform Support

See otter-jsc-sys for platform support details.

License

MIT

Commit count: 0

cargo fmt