[][src]Crate csharpbindgen

csharpbindgen is a library for generating low-level C# bindings from Rust code.

It is currently in a very primitive state, largely designed for use by the Unity Pathfinder plugin and missing many features.

Quick start

The library is intended for use via a Cargo build script.

Here's an example of a simple program that converts some simple Rust code into C#:

let rust = r#"
  pub unsafe extern "C" fn my_func(foo: i32) -> f32 { /* ... */ }
let code = csharpbindgen::Builder::new("MyDll", rust.to_string())

println!("{}", code);

This will print out something like the following C# code:

// This file has been auto-generated, please do not edit it.

using System;
using System.Runtime.InteropServices;

internal class MyStuff {
    internal static extern float my_func(Int32 foo);

For a more complete example, see the Unity Pathfinder plugin's build.rs.



A builder pattern for the Rust-to-C# conversion process.



Enumeration for C#'s access modifiers.


This represents an error from the library.