[][src]Crate coercible_errors

Zero-cost error handling for generic traits.

Rationale

Assume you want to build a crate that defines a generic trait, meant to be implemented by others. Some implementations of that trait will always succeed, others may sometimes fail. The methods of the generic trait should therefore return Result<_,_>, but that should not induce an overhead for infallible implementations (per the zero-cost abstraction motto).

The coercible_errors! macro will define a set of traits and types that you can use to define your generic traits, in order to keep their error-handling as efficient as possible. More precisely, the compiler will be able to optimize away the error types whenever only infallible implementations of the generic trait are used.

See README.md for a more detailed explaination.

Modules

example_generated

This module contains the traits and types defined by coercible_errors!.

Macros

coercible_errors

Sets up coercible_errors for a previously defined error type.

Enums

Never

An "error" type that can never happen.

Type Definitions

OkResult

Type alias for a result that will Never fail.