GithubHelp home page GithubHelp logo

rnet's Introduction

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.

rnet's People

Contributors

diggsey avatar microhobby avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rnet's Issues

Cannot use a SystemTime

I write a DLL with Rnet and I want to get a SystemTime in argument of my function. How can I do?

Maintainence Status

Hey @Diggsey , let me know if you still want to continue maintaining this project or if some member of the community could fork it and continue the maintenance.

There are some changes in the newest versions of Rust that need attention slint-ui/slint#3913 (comment)

let me know

just some questions

  1. Is there a way to expose a struct to .NET where one of the fields does not implement the required traits? I'm not planning to make this field visible in the .NET side. I suppose I can make a global hashmap to store these fields and have these structs contain keys to index said map but I wonder if there is a better way to do this?

  2. Is there a way to make functions that can accept any .NET type? I tried using generics but the macros didn't seem to like them.

  3. Would you be open to a PR that adds the ability to generate another language than just C#? (F# to be precise). It isn't a huge deal if not as I can just make the C# file its own library but it would reduce some boilerplate and would make the functions nicer to call.

For a bit of context: I have a rust library which I want to expose to one of my F# projects. I'm currently in the "toying around/experiment" phase though.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.