LabKit MATLAB Workbench

reference

API ReferenceFramework Compatibility Contracts

labkit.contract.requirements

Describe the LabKit API versions required by a caller.

Syntax

req = labkit.contract.requirements("app", ">=1.0 <2", ...)

Description

Builds a normalized requirement structure from facade/range pairs. A facade name may be written as "app" or "labkit.app". Names are converted to lowercase and the optional "labkit." prefix is removed. No compatibility check is performed until checkRequirements or assertRequirements is called.

Inputs

varargin
Alternating facade names and version ranges. Facade names are text scalars containing letters, digits, or underscores. A range is a nonempty text scalar containing whitespace-separated constraints such as ">=2.0 <3". Supported operators are >, >=, <, <=, =, and ==.

Outputs

req
Scalar structure with type="labkit.requirements" and a facades structure array. Each facades element has normalized facade and range fields. Calling requirements() with no pairs returns an empty list.

Errors

Throws labkit:contract:InvalidRequirements for an odd number of arguments, labkit:contract:InvalidFacadeName for an invalid name, labkit:contract:InvalidVersionRange for an empty or nontext range, and labkit:contract:DuplicateRequirement when a facade appears more than once.

Example

req = labkit.contract.requirements( ...
"app", ">=1 <2", ...
"image", ">=4.0 <5");
report = labkit.contract.checkRequirements(req);

Source

This page is generated from the MATLAB help text in +labkit/+contract/requirements.m.