Rustly 10.0.0-rc

This is a prerelease version of Rustly.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Rustly --version 10.0.0-rc
                    
NuGet\Install-Package Rustly -Version 10.0.0-rc
                    
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="Rustly" Version="10.0.0-rc" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rustly" Version="10.0.0-rc" />
                    
Directory.Packages.props
<PackageReference Include="Rustly" />
                    
Project file
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 Rustly --version 10.0.0-rc
                    
#r "nuget: Rustly, 10.0.0-rc"
                    
#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 Rustly@10.0.0-rc
                    
#: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=Rustly&version=10.0.0-rc&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Rustly&version=10.0.0-rc&prerelease
                    
Install as a Cake Tool

Rustly (v10.0.0-rc)

Rust-inspired Result<T, E>, Option<T>, and Unit types for C#. Replace exceptions with explicit, composable error handling. Zero-allocation value types.

Installation

dotnet add package Rustly --version 10.0.0-rc

Types

Type Description
Result<T, E> Success (Ok) or error (Err) — discriminated union
Option<T> Some(T) or None — nullable alternative
Unit Void replacement for Result<Unit, E>

Usage

Result<T, E>

using Rustly;

Result<int, string> Divide(int a, int b)
{
    if (b == 0)
        return Result<int, string>.Err("Division by zero");
    return Result<int, string>.Ok(a / b);
}

var result = Divide(10, 2);

// Pattern matching
string message = result.Match(
    ok: value => $"Result: {value}",
    err: error => $"Error: {error}"
);

// Chaining
var doubled = Divide(10, 2)
    .Map(x => x * 2)
    .UnwrapOr(0);

// Composition
var final = Divide(10, 2)
    .AndThen(x => Divide(x, 3))
    .MapErr(e => $"Pipeline failed: {e}");

Result<Unit, E> (void operations)

using Rustly;

Result<Unit, string> SaveFile(string path)
{
    // ... operation ...
    return Result<Unit, string>.Ok(Unit.Value);
}

SaveFile("/tmp/data.txt")
    .InspectErr(e => Console.WriteLine($"Save failed: {e}"));

Option<T>

using Rustly;

Option<string> FindUser(int id)
{
    if (id == 1)
        return Option<string>.Some("Admin");
    return Option<string>.None;
}

// Safe access
string name = FindUser(1).UnwrapOr("Unknown");

// Chaining
var greeting = FindUser(1)
    .Map(n => $"Hello, {n}!")
    .UnwrapOr("Hello, stranger!");

// Pattern matching
FindUser(42).Match(
    some: user => Console.WriteLine($"Found: {user}"),
    none: () => Console.WriteLine("Not found")
);

API Reference

Result<T, E>

Method Description
Ok(T) Create success result
Err(E) Create error result
IsOk / IsErr Check variant
Unwrap() Get success value (unsafe)
UnwrapErr() Get error value (unsafe)
UnwrapOr(T) Get value or default
UnwrapOrElse(Func<E, T>) Get value or compute default
Map(Func<T, U>) Transform success value
MapErr(Func<E, F>) Transform error value
AndThen(Func<T, Result<U, E>>) Chain operations
OrElse(Func<E, Result<T, F>>) Recover from errors
Inspect(Action<T>) Side-effect on Ok
InspectErr(Action<E>) Side-effect on Err
Match(Func<T, U>, Func<E, U>) Pattern match
ToOption() Convert Ok→Some, Err→None

Option<T>

Method Description
Some(T) Create option with value
None Empty option
IsSome / IsNone Check variant
Unwrap() Get value (unsafe)
UnwrapOr(T) Get value or default
UnwrapOrElse(Func<T>) Get value or compute default
Map(Func<T, U>) Transform value
AndThen(Func<T, Option<U>>) Chain operations
Inspect(Action<T>) Side-effect on Some
Match(Func<T, U>, Func<U>) Pattern match
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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 is compatible.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.

NuGet packages (5)

Showing the top 5 NuGet packages that depend on Rustly:

Package Downloads
Slotly.Core

Core types for the Slotly plugin framework: IPlugin, IPluginManifest, PluginState, PluginError, IPluginContext.

Rustly.Json

System.Text.Json converters for Rustly Option, Result, and EnumValue. Includes source generators for AOT-friendly serialization. Part of the Rustly ecosystem.

Rustly.Json.Newtonsoft

Newtonsoft.Json converters for Rustly Option, Result, and EnumValue enums. Part of the Rustly ecosystem.

Rustly.Configuration

IConfiguration binding for Rustly types. RBind() handles Option and EnumValue object format seamlessly. Part of the Rustly ecosystem.

TunnelForge.Tun

Cross-platform TUN adapter abstraction for .NET. Unified ITunAdapter interface for Windows (WinTun) and Linux (/dev/net/tun). Error handling via Rustly Result<T, E> — no exceptions.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.6.4 936 4/28/2026
10.6.3 234 4/16/2026
10.6.2 241 4/16/2026
10.6.2-rc6 258 4/16/2026
10.6.2-rc5 304 4/15/2026 10.6.2-rc5 is deprecated because it is no longer maintained and has critical bugs.
10.6.1 176 4/15/2026
10.5.0 221 4/15/2026 10.5.0 is deprecated because it is no longer maintained and has critical bugs.
10.4.0 237 4/15/2026 10.4.0 is deprecated because it is no longer maintained and has critical bugs.
10.3.1 229 4/14/2026 10.3.1 is deprecated because it is no longer maintained and has critical bugs.
10.2.1 667 4/14/2026 10.2.1 is deprecated because it is no longer maintained and has critical bugs.
10.2.0 1,234 4/13/2026 10.2.0 is deprecated because it is no longer maintained and has critical bugs.
10.1.1 129 4/13/2026 10.1.1 is deprecated because it is no longer maintained and has critical bugs.
10.1.0 140 4/13/2026 10.1.0 is deprecated because it is no longer maintained and has critical bugs.
10.0.3 132 4/13/2026 10.0.3 is deprecated because it is no longer maintained and has critical bugs.
10.0.2 239 4/8/2026 10.0.2 is deprecated because it is no longer maintained and has critical bugs.
10.0.1 132 4/8/2026 10.0.1 is deprecated because it is no longer maintained and has critical bugs.
10.0.0 129 4/8/2026 10.0.0 is deprecated because it is no longer maintained and has critical bugs.
10.0.0-rc2 122 4/8/2026 10.0.0-rc2 is deprecated because it is no longer maintained and has critical bugs.
10.0.0-rc 125 4/8/2026 10.0.0-rc is deprecated because it is no longer maintained and has critical bugs.

EN:
Version 10.0.0-rc:
- Result<T, E> — discriminated union for success/error with Map, MapErr, AndThen, OrElse, Unwrap.
- Option<T> — nullable alternative with Map, AndThen, UnwrapOr, IsSome/IsNone.
- Unit — void replacement for use in Result<Unit, E>.
- Full XML documentation.

RU:
Версия 10.0.0-rc:
- Result<T, E> — размеченное объединение для успеха/ошибки с Map, MapErr, AndThen, OrElse, Unwrap.
- Option<T> — альтернатива nullable с Map, AndThen, UnwrapOr, IsSome/IsNone.
- Unit — замена void для использования в Result<Unit, E>.
- Полная XML-документация.