Crate rnet[][src]

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

Must be called by the cdylib crate.

Structs

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

Rust type which can store and call a corresponding Func<...> or Action<...> delegate from .net.

This error type can be used to capture exceptions from .net when calling a delegate with the appropriate Result<T, NetException> type.

Traits

This trait is implemented for Rust types which can be received from .net code.

This trait is implemented for Rust types which can be used as arguments to exported functions. This is a superset of types which implement FromNet, and allows passing types with lifetime arguments, like &str.

This trait is implemented for Rust types which can be returned from .net delegates. This is a superset of types which implement FromNet, and allows returning eg. the unit () type, whose .net equivalent void cannot be used as a normal type.

This trait is implemented for Rust types which have an equivalent type within .net.

This trait is implemented for Rust types which can be sent to .net code.

This trait is implemented for Rust types which can be used as arguments to .net delegates. This is a superset of types which implement ToNet, and allows passing types with lifetime arguments, like &str.

This trait is implemented for Rust types which can be returned from exported functions. This is a superset of types which implement ToNet, and allows returning eg. the unit () type, whose .net equivalent void cannot be used as a normal type.

Attribute Macros

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

Derive Macros

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.