2 releases

Uses new Rust 2024

0.1.2 Dec 1, 2025
0.1.1 Nov 30, 2025

#155 in FFI

MIT/Apache

24KB
488 lines

Table of Contents

  1. Discription
  2. Overview
  3. Project Structure
  4. Features
  5. Quick Start
    1. Use Ngrs
    2. Example
    3. Initialization
      1. Using with `init`
      2. Using with `withguile`
English 中文

Discription

NGRS is a New Rust bindings for GNU Guile Scheme.

Overview

`ngrs` provides both low-level raw bindings and high-level safe abstractions for embedding GNU Guile Scheme in Rust applications. This project enables seamless integration of Scheme scripting capabilities into Rust programs with a focus on memory safety and ergonomic APIs.

Project Structure

  • ngrs - High-level safe Rust wrappers with idiomatic interfaces, Contains raw.
  • raw - Low-level FFI bindings to Guile's C API

Features

  • Make bindings and convert for base values.

Quick Start

Use Ngrs

Add this to your Cargo.toml .

[dependencies]
ngrs = "0.1"

Example

use ngrs::{Runtime, with_guile};

fn main() {
    // Initialize Guile
    Runtime::initialize();

    with_guile(|vm:Runtime| {
        // Your Code Here
        println!("Hello guile from Rust!");
        let args = vec!["Test Guile".to_string(),];
        vm.shell(args);
    });
}

Initialization

Before using any Guile functionality, you must initialize the Guile environment:

use ngrs::Runtime

fn main() {
    // Initialize Guile
    Runtime::initialize();

    // Your code here
}

Using with `init`

This way has Less platforms support.

use ngrs::Runtime;

fn main() {
    Runtime::initialize();
    let runtime = Runtime::new();

    // Your Guile-dependent code here
}

Using with `withguile`

For more control over the Guile context:

use ngrs::with_guile;

fn main() {
    Runtime::initialize();

    with_guile(|vm:Runtime| {
        // Your Guile-dependent code here
    });
}

Dependencies

~0.4–3MB
~62K SLoC