#exception #panic #io #default #build #new-delete #iostream

cruppers

A minimal crate to support using no_std Rust libraries in C++

5 releases

0.5.0 Oct 9, 2023
0.4.3 Oct 3, 2023
0.4.2 Sep 27, 2023
0.4.1 Aug 22, 2023
0.4.0 Aug 22, 2023

#14 in #exception


Used in lemurs-8080

UPL-1.0 license

9KB
192 lines

Cruppers

This is a lightweight crate to support using #![no_std] Rust libraries in C++ programs. It uses C++ facilities (new/delete, exceptions, iostream) to provide the facilities (alloc, panic, print macros) that Rust crates normally lose access to when they give up the standard library.

This makes it fairly easy to create Rust libraries that can be used from either Rust or C++. The assumed use case is that you create a Rust crate with a C API and a crate-type that includes staticlib, then add a dependency on this crate. If you don't want a specific feature (like stdout), you can disable building it by disabling default features on the dependency and enabling them individually.

This crate is in pretty early development. It passes initial use cases for most features, but it hasn't been pushed very far yet.

Currently, this crate requires nightly builds; that dependency should be removed once the appropriate features are stabilized.

No runtime deps

~170KB