InterfaceInfo

Provides all necessary informations to implement an automated interface or class. inspired by /web/vibe/web/internal/rest/common.d

Constructors

this
this(int dummy)

Fills the struct with information.

Postblit

this(this)
this(this)
Undocumented in source.

Members

Aliases

BaseInterfaces
alias BaseInterfaces = InterfacesTuple!T
Undocumented in source.
I
alias I = T
Undocumented in source.
I
alias I = BaseInterfaces[0]
Undocumented in source.
Members
alias Members = GetMembers!()

Aliases to all interface methods (Compile-time).

Methods
alias Methods = GetMethods!()

Aliases for each method (Compile-time). This tuple has the same number of entries as methods.

Manifest constants

memberNames
enum memberNames;

The name of each interface member (Runtime).

methodCount
enum methodCount;

Number of methods (Runtime).

Static variables

staticMethods
StaticMethodInfo[methodCount] staticMethods;

Static information about each route (Compile-time).

staticMethods
StaticMethodInfo[0] staticMethods;
Undocumented in source.

Variables

methods
MethodInfo[methodCount] methods;

Information about each route (Runtime). This array has the same number of fields as RouteFunctions.

Examples

import std.typecons : tuple;
import std.traits;

@("api")
interface IAPI
{
    @("value")
    string hello(int number);

    @noAutoImplement()
    void disabledMethod();
}

alias Info = InterfaceInfo!IAPI; // Compile-time infos
auto info = new Info(0); // Runtime infos

// Runtime infos
assert(info.memberNames.length == 2);
assert(info.memberNames[0] == "hello");
assert(info.memberNames[1] == "disabledMethod");
assert(info.methodCount == 1 );
assert(info.methods.length == 1);
assert(info.methods[0].name == "hello");
assert(info.methods[0].parameters.length == 1);
assert(info.methods[0].parameters[0].name == "number");

// Compile time
static assert(Info.Members.length == 2);
static assert(Info.Methods.length == 1);

static assert(Info.staticMethods.length == 1);
static assert(Info.staticMethods[0].name == "hello");
static assert(Info.staticMethods[0].parameters.length == 1);
static assert(Info.staticMethods[0].parameters[0].name == "number");

Meta