borkdude
clojure-rust-graalvm
Rust

An example of Clojure program calling a Rust library, all combined into one executable using GraalVM.

Last updated Apr 14, 2026
145
Stars
6
Forks
0
Issues
0
Stars/day
Attention Score
21
Language breakdown
Rust 37.5%
Clojure 32.3%
Shell 22.3%
Java 7.8%
โ–ธ Files click to expand
README

clojure-rust-graalvm

An example of Clojure program calling a Rust library, all combined into one executable using GraalVM. It gets the amount of free memory via the heim-rs library and prints it in EDN format.

This repo is an adapted example of what is described in the README of the Rust jni library.

In clojure/src-java there is a Java static method which calls a Rust function via JNI. We call this static method from Clojure.

Usage

shell
$ time ./clojure-rust megabyte
{:memory/free [:megabyte "1210"]}
./clojure-rust megabyte   0.01s  user 0.01s system 34% cpu 0.027 total

Accepted options: byte, megabyte, gigabyte.

Build

Prerequisites:

Run script/compile to build the Rust lib, the Clojure uberjar and the GraalVM executable.

Finally, run the executable:

shell
$ target/clojure-rust
{:memory/free [:byte "896126976"]}

License

Copyright ยฉ 2020 Michiel Borkent

Distributed under the EPL License, same as Clojure. See LICENSE.

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท borkdude/clojure-rust-graalvm ยท Updated daily from GitHub