5 releases

Uses new Rust 2024

0.1.4 Mar 11, 2026
0.1.3 Mar 1, 2026
0.1.2 Feb 28, 2026
0.1.1 Feb 28, 2026
0.1.0 Feb 28, 2026

#568 in Compression

Download history 47/week @ 2026-03-01 43/week @ 2026-03-08 9/week @ 2026-03-15 52/week @ 2026-03-22 6/week @ 2026-03-29

80 downloads per month
Used in shell-cell

MIT/Apache

24KB
358 lines

cue-rs

Rust bindings for the CUE language runtime, built as a wrapper around libcue — the official C interface to the CUE Go runtime.

[!WARNING] The API is unstable and could change in the future.

libcue exposes the CUE evaluation engine (written in Go) as a C API via cgo. The build script compiles it into a static archive (libcue.a) which is then statically linked into the Rust crate, exposing a safe Rust API on top.

flowchart TD
    subgraph libcue ["libcue (libcue.a)"]
        Go["🐹 Go (CUE runtime)"]
        C["⚙️ C interface (cgo)"]
        Go --> C
    end

    libcue -->|"statically linked"| Rust["🦀 Rust"]

Requirements

  • Go 1.24+ — the Go toolchain is required.

Usage

use cue_rs::{Ctx, Value};

let ctx = Ctx::new().unwrap();
let v = Value::compile_string(&ctx, r#"{ name: "alice", age: 30 }"#).unwrap();

v.is_valid().unwrap();
println!("{}", serde_json::from_slice::<serde_json::Value>(&v.to_json_bytes().unwrap()).unwrap());

Examples

More examples can be found in the examples/ directory.

Dependencies

~260–700KB
~14K SLoC