4 releases (2 breaking)

0.3.1 Nov 15, 2023
0.3.0 Nov 15, 2023
0.2.0 Nov 22, 2021
0.1.0 Nov 9, 2021

#91 in #standalone

Download history 33/week @ 2024-08-31 2/week @ 2024-09-07 14/week @ 2024-09-21 11/week @ 2024-09-28 1/week @ 2024-10-05 6/week @ 2024-10-12 5/week @ 2024-10-19 7/week @ 2024-11-16 9/week @ 2024-11-23 1/week @ 2024-11-30 13/week @ 2024-12-07 56/week @ 2024-12-14

82 downloads per month
Used in 2 crates (via rnet)

MIT/Apache

13KB
267 lines

rnet

Easily call into Rust from C# or other .net langauges.

Usage

  1. Add rnet::root!(); to your crate.
  2. Use #[derive(Net)] on any structs to be shared with .net.
  3. Apply the #[net] attribute to any standalone functions which should be callable from .net.
  4. Build your rust project as a cdylib.
  5. Generate C# bindings for your project:
    cargo install rnet-gen
    rnet-gen "<path to .dll/.so/.dylib>" > "<path to generated file.cs>"
    
  6. Include the C# file in your .net project.
  7. Add a link to the compiled rust library to your .net project, and set it to "Copy if newer".
  8. Optional: Configure the above steps to run automatically as pre-build steps.

For languages other than C#, you'll need to build the exported C# file into its own class library, and then add a reference to that from a project of any .net language.


lib.rs:

rnet-macros

Procedural macros for rnet

Dependencies

~2MB
~45K SLoC