27. Miscelanious contract annotations

The CONTRACTS module exposes collection of type matching contracts.

All functions and symbols are in “contracts” module, use require to get access to it.

require daslib/contracts

27.1. Function annotations

expect_any_array

[expect_any_array(argname)] contract, which only accepts array<T>, T[], or das`vector<T>

expect_dim

[expect_dim(argname)] contract, which only accepts T[]

expect_any_enum

[expect_any_enum(argname)] contract, which only accepts enumerations

expect_any_bitfield

[expect_any_bitfield(argname)] contract, which only accepts bitfields

expect_any_vector_type

[expect_any_vector_type(argname)] contract, which only accepts vector types, i.e. int2, float3, range, etc

expect_any_struct

[expect_any_struct(argname)] contract, which only accepts structs (byt not classes)

expect_any_numeric

[expect_any_numeric(argname)] contract, which only accepts numeric types (int, float, etc)

expect_any_workhorse

[expect_any_workhorse(argname)] contract, which only accepts workhorse types (int, float, etc) Workhorse types are: bool,int*,uint*,float*,double,range and urange, range64 and urange64, string,enumeration,and non-smart pointers

expect_any_workhorse_raw

[expect_any_workhorse_raw(argname)] contract, which only accepts workhorse types which are raw (not pointer or bool)

expect_any_tuple

[expect_any_tuple(argname)] contract, which only accepts tuples

expect_any_variant

[expected_any_variant(argname)] contract, which only accepts variants

expect_any_function

[expect_any_function(argname)] contract, which only accepts functions

expect_any_lambda

[expect_any_lambda(argname)] contract, which only accepts lambdas

expect_ref

[expect_ref(argname)] contract, which only accepts references

expect_pointer

[expect_pointer(argname)] contract, which only accepts pointers

expect_class

[expect_class(argname)] contract, which only accepts class instances

expect_value_handle

[expect_value_handle(argname)] contract, which only accepts value handles

27.2. Type queries

isYetAnotherVectorTemplate(td: TypeDeclPtr)

isYetAnotherVectorTemplate returns bool

argument

argument type

td

TypeDeclPtr

returns true if the given type declaration is a das::vector template bound on C++ side