REslava.Result API Reference

Functional error handling & zero-boilerplate Minimal APIs for .NET.
Type-safe Result<T>, discriminated unions, source generators.

Namespaces

Browse the full type inventory for each namespace.

REslava.Result

Core library. Result<T>, Result<TValue,TError>, Maybe<T>, and the full error hierarchy — Error, ValidationError, ExceptionError, ConversionError, Reason<T>.

REslava.Result.AdvancedPatterns

Discriminated unions and typed error pipelines. OneOf<T1..T8> (sealed class) · ErrorsOf<T1..T8> (typed error union, implements IError) · OneOfBase<T1..T8> (shared dispatch) · IOneOf<T1..T8> · Maybe<T>.

REslava.Result.Extensions

Functional extension methods for Result<T> and Result<TValue,TError>: Map, Bind ×7, Tap, Ensure ×7, MapError, WhenAll, Retry, Timeout, ToIResult, ToActionResult and async variants.

REslava.Result.Serialization

System.Text.Json converters for Result<T>, Maybe<T>, and error types. Enables seamless serialization in web APIs and distributed systems.

REslava.Result.Http

HttpClient extensions that return Result<T> instead of throwing. Maps HTTP 4xx/5xx to typed domain errors (NotFoundError, UnauthorizedError, …) and wraps network failures in ExceptionError.

Core Types at a Glance

The most commonly used types across the library.

Result<T>

Wraps a success value or a list of errors. The primary return type for all fallible operations. Use .IsSuccess, .Value, .Errors.

Maybe<T>

Null-safe optional value. Eliminates null reference checks with a type-safe Some / None distinction.

OneOf<T1..T8>

Discriminated union (sealed class). Represents exactly one of 2–8 types. Ideal for service methods that return different success shapes.

ErrorsOf<T1..T8>

Typed error union (where Ti : IError). Implements IError — usable as TError in Result<TValue,TError>. Exhaustive Match enforced at compile time.

Result<TValue, TError>

Typed result with a concrete compile-time error type. Each Bind step grows the error union by one slot. Use .IsSuccess, .Value, .Error.

Error hierarchy

Error · ValidationError (field + message) · ExceptionError · ConversionError. All implement IError with tag-based HTTP status mapping.

Reason<TReason>

Base class for all reasons (successes and errors). Carries a Message, optional Tags dictionary, and CRTP fluent builder pattern.

Extension methods

Functional pipeline: Map → Bind → Tap → Ensure → ToIResult. Async variants for all operations. Combinators: WhenAll, Retry, Timeout.

Use the namespace menu at the top to browse all types. Source generators and analyzer rules are documented in the main docs.