RustBridge.Core
1.0.2
dotnet add package RustBridge.Core --version 1.0.2
NuGet\Install-Package RustBridge.Core -Version 1.0.2
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="RustBridge.Core" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RustBridge.Core" Version="1.0.2" />
<PackageReference Include="RustBridge.Core" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RustBridge.Core --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: RustBridge.Core, 1.0.2"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package RustBridge.Core@1.0.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RustBridge.Core&version=1.0.2
#tool nuget:?package=RustBridge.Core&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
RustBridge C# Bindings
C# bindings for the RustBridge plugin framework.
Installation
dotnet add package RustBridge.Core
dotnet add package RustBridge.Native
Requirements
- .NET 8.0 SDK or later
- A RustBridge plugin compiled as a native library (.dll on Windows, .so on Linux, .dylib on macOS)
Projects
- RustBridge.Core - Core interfaces and types (IPlugin, PluginConfig, etc.)
- RustBridge.Native - P/Invoke-based native plugin loader
- RustBridge.Tests - Unit and integration tests
- RustBridge.Benchmarks - BenchmarkDotNet performance benchmarks
Quick Start
using RustBridge;
using RustBridge.Native;
// Load a plugin
using var plugin = NativePluginLoader.Load("path/to/plugin.dll");
// Make a call
var response = plugin.Call("echo", "{\"message\": \"hello\"}");
Console.WriteLine(response);
// Or with typed request/response
var result = plugin.Call<MyRequest, MyResponse>("my.operation", new MyRequest { Value = 42 });
Building
dotnet build
dotnet test
Benchmarks
Run performance benchmarks using BenchmarkDotNet:
# Build the hello-plugin first
cargo build --release -p hello-plugin
# Run all benchmarks
cd RustBridge.Benchmarks
dotnet run -c Release
# Run specific benchmark
dotnet run -c Release -- --filter "*TransportBenchmark*"
dotnet run -c Release -- --filter "*ThroughputBenchmark*"
dotnet run -c Release -- --filter "*ConcurrentBenchmark*"
Available benchmarks:
- TransportBenchmark - Latency comparison between JSON and binary transport
- ThroughputBenchmark - Operations per second for sustained load
- ConcurrentBenchmark - Multi-threaded scalability (100 concurrent tasks)
Configuration
var config = PluginConfig.Defaults()
.WorkerThreads(4)
.WithLogLevel(LogLevel.Debug)
.MaxConcurrentOps(500)
.Set("custom_key", "custom_value");
using var plugin = NativePluginLoader.Load("plugin.dll", config);
Log Callback
void HandleLog(LogLevel level, string target, string message)
{
Console.WriteLine($"[{level}] {target}: {message}");
}
using var plugin = NativePluginLoader.Load("plugin.dll", config, HandleLog);
Architecture
The C# bindings follow the same architecture as the Java bindings:
- Core abstractions - Platform-independent interfaces and types
- Native bindings - P/Invoke declarations for the C FFI
- Plugin implementation - Manages native library lifecycle and memory
Memory follows "Rust allocates, host frees" pattern. The native plugin handle is properly disposed when the IPlugin is disposed.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- NSec.Cryptography (>= 24.4.0)
- System.Text.Json (>= 8.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RustBridge.Core:
| Package | Downloads |
|---|---|
|
RustBridge.Native
P/Invoke bindings for RustBridge - load and call Rust plugins from .NET |
GitHub repositories
This package is not used by any popular GitHub repositories.