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. Contains Result<T>, Maybe<T>, OneOf<T1,T2[,T3,T4]>, and the full error hierarchy — Error, ValidationError, ExceptionError, ConversionError, Reason<T>.

REslava.Result.AdvancedPatterns

Advanced compositional types. Utilities for building richer domain models with discriminated unions, validation pipelines, and structured error hierarchies.

REslava.Result.Extensions

Functional extension methods: Map, MapAsync, Bind, BindAsync, Tap, Ensure, WhenAll, Retry, Timeout, ToIResult, ToActionResult and more.

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, T2[, T3, T4, T5, T6]>

Discriminated union. Represents exactly one of 2–6 types. Ideal for service methods that return different success shapes.

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.