Ferrous Ferrous

Rust-grade compile-time safety for .NET

Zero-allocation Result<T, E> & Option<T>, data-owning Mutex<T> & structured TaskScope, zero-boxing [DiscriminatedUnion] & [Newtype] generators, CFG ownership/typestate analyzers, and Clippy-style diagnostics—polyfilling on .NET 10 and lighting up natively on .NET 11 / C# 15.

dotnet add package Ferrous

Core Pillars

Zero-Allocation Primitives

Stack-only Result<T, TError>, Option<T>, ContextError chains, ScopeGuard RAII defer/rollback, NonZero<T>, NonEmptyString, and checked math.

Unions, Newtypes & Tracing

Source-generated zero-boxing [DiscriminatedUnion] (with .NET 11 [Union] light-up), validated [Newtype] wrappers, and [Instrument] Activity spans.

Ownership & Typestates

CFG-based Roslyn analyzers enforcing move semantics ([Consuming] / [ConsumesSelf]), borrow exclusivity, linear [Typestate] protocols, and terminal-state leak checks.

Fearless Concurrency

Data-owning Mutex<T>, AsyncMutex<T>, RwLock<T>, TypedChannel, and structured TaskScope—backed by FE0500–FE0503 analyzers.

Web & Data Integrations

Opt-in Ferrous.AspNetCore (RFC 7807 ProblemDetails & .WithFerrousResults()) and Ferrous.EntityFrameworkCore value converters & FirstOrErrAsync queries.

Testing, Docs & Migration

CompileAssert (trybuild), PropAssert shrinking property tests, AllocAssert.Zero, dotnet fe doc static API docs, IDE Ctrl+. refactorings, and dotnet fe migrate.