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_not_dim

[expect_not_dim(argname)] contract, which never accepts T[]

expect_any_enum

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

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,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

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