rnet

Crates.iornet
lib.rsrnet
version0.3.1
sourcesrc
created_at2021-11-09 00:18:39.878957
updated_at2023-11-15 23:58:13.323798
descriptionEasily call into Rust from C# or other .net langauges.
homepage
repositoryhttps://github.com/Diggsey/rnet
max_upload_size
id478690
size55,929
Diggory Blake (Diggsey)

documentation

README

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.

Commit count: 16

cargo fmt