Crate rnet

Source
Expand description

§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.

Macros§

root
Must be called by the cdylib crate.

Structs§

Delegate0
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate1
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate2
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate3
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate4
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate5
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate6
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate7
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate8
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
Delegate9
Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.
NetException
This error type can be used to capture exceptions from .net when calling a delegate with the appropriate Result<T, NetException> type.

Traits§

FromNet
Safety
FromNetArg
Safety
FromNetReturn
Safety
Net
Safety
ToNet
Safety
ToNetArg
Safety
ToNetReturn
Safety

Attribute Macros§

net
This attribute can be applied to a standalone function to allow it to be called from .net.

Derive Macros§

Net
This derive will implement the Net, ToNet, and FromNet traits for the given struct, allowing it to be passed to or returned from .net code.