Module bolts.experimental.signatures

Provides utilites that allow you to enforce signatures - a specification for a structure

Example

interface InputRange(T) {
    @property bool empty();
    @property T front();
    @ignoreAttributes void popFront();
}

struct R(T) {
    mixin Models!(InputRange!T);

    T[] values;
    int index;
    this(T[] arr) {
        values = arr;
    }
    @property bool empty() {
        return values.length == index;
    }
    @property T front() {
        return values[index];
    }
    void popFront() {
        index++;
    }
}

import std.range: array;
auto r = R!int([1, 4, 2, 3]);
assert(r.array == [1, 4, 2, 3]);

Structs

NameDescription
ignoreAttributes Attribute that can be applied on identifiers in a signature that will let the model checker know not to take attributes in to account
ignoreQualifiers Attribute that can be applied on identifiers in a signature that will let the model checker know not to take type qualifiers in to account

Templates

NameDescription
Models Mixin that ensures a type models the desired signature of a structure

Manifest constants

NameTypeDescription
AssertModelOf Asserts that the given model follows the specification of the given signature
isModelOf Checks if type Model is a model of type Sig