Latest 0.7
License MIT
Platforms ios 8.0, osx 10.9, requires ARC

An imperfect but more performant implementation of the Result pattern in Swift.

Lustre defines an interface with several manual specializations to improve
compiler inference and and runtime performance over a Box<T>-based Result
type, such as that from LlamaKit.

Day-to-day syntax of using Lustre’s Result types are almost identical, except
in that you must chose specific types to use for Result instances.

VoidResult and ObjectResult are fully-implemented specializations ready
for use out of the box with no-return results and reference type results,

AnyResult is a fallback for any value type. Any is used as storage of any
T. Types under 17 bytes in size will be stored inline, so results of
all primitive types and most Swift collection types will have the same
performance of a specialized generic enum. Larger types are stored using a
native buffer type internal to Swift.

The CustomResult protocol exists for manual specializations for custom types
of a known size. For example, a JSON-parsing library might provide a JSON
enum, and JSONResult would conform to CustomResult with a .Success(JSON)

The common-case implementation of Result<T> is clearly the way forward. Until
Swift supports multi-payload generic enums, Lustre.Result mitigates the
performance problems around using a Box<T>-based Result type.


Lustre is intended for Swift 1.2. Compatibility with future versions is not

What’s up with the name?

Result => Lustre. It’s an anagram.

Latest podspec

    "name": "Lustre",
    "version": "0.7",
    "summary": "An imperfect but more performant Result pattern in Swift.",
    "description": "                   An imperfect but more performant implementation of the Resultn                   pattern in Swift.nn                   The common-case implementation of `Result is clearly then                   future, but until Swift supports multi-payload generic enums,n                   Lustre mitigates the performance problems of a `Box`n                   Result type.n",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Zachary Waldowski": "[email protected]"
    "social_media_url": "",
    "platforms": {
        "ios": "8.0",
        "osx": "10.9"
    "source": {
        "git": "",
        "tag": "v0.7"
    "source_files": "Lustre/*.swift",
    "requires_arc": true

Pin It on Pinterest

Share This