{"id":13477807,"url":"https://github.com/anweiss/cddl","last_synced_at":"2026-02-11T18:01:37.125Z","repository":{"id":40725277,"uuid":"181521537","full_name":"anweiss/cddl","owner":"anweiss","description":"Concise data definition language (RFC 8610) implementation and JSON and CBOR validator in Rust","archived":false,"fork":false,"pushed_at":"2025-03-06T21:37:07.000Z","size":20315,"stargazers_count":95,"open_issues_count":24,"forks_count":15,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-06T22:23:58.958Z","etag":null,"topics":["cbor","cddl","json","rust"],"latest_commit_sha":null,"homepage":"https://cddl.anweiss.tech","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/anweiss.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-15T16:04:09.000Z","updated_at":"2025-03-06T21:37:11.000Z","dependencies_parsed_at":"2023-12-11T21:24:42.454Z","dependency_job_id":"601ddc5e-23a7-4252-84a8-eca255aa763f","html_url":"https://github.com/anweiss/cddl","commit_stats":{"total_commits":674,"total_committers":11,"mean_commits":61.27272727272727,"dds":0.400593471810089,"last_synced_commit":"ed0493c282bdf2cb86ad2b6a7339adc1e4f7f3ed"},"previous_names":[],"tags_count":52,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anweiss%2Fcddl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anweiss%2Fcddl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anweiss%2Fcddl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anweiss%2Fcddl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anweiss","download_url":"https://codeload.github.com/anweiss/cddl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245797272,"owners_count":20673824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cbor","cddl","json","rust"],"created_at":"2024-07-31T16:01:47.845Z","updated_at":"2025-12-12T14:00:38.129Z","avatar_url":"https://github.com/anweiss.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# cddl-rs\n\n[![crates.io](https://img.shields.io/crates/v/cddl.svg)](https://crates.io/crates/cddl) [![docs.rs](https://docs.rs/cddl/badge.svg)](https://docs.rs/cddl) [![Build and Test](https://github.com/anweiss/cddl/workflows/Build%20and%20Test/badge.svg)](https://github.com/anweiss/cddl/actions?query=workflow%3A%22Build+and+Test%22) [![Active Development](https://img.shields.io/badge/Maintenance%20Level-Actively%20Developed-brightgreen.svg)](https://gist.github.com/cheerfulstoic/d107229326a01ff0f333a1d3476e068d)\n\n\u003e This crate was originally developed as a personal learning exercise for getting acquainted with Rust and parsing in general. There are likely more performant and stable libraries out there for parsing CDDL. While there are some examples of this crate being used in production, careful consideration should be made prior to using this crate as such.\n\nA Rust implementation of the Concise data definition language (CDDL). CDDL is an IETF standard that \"proposes a notational convention to express CBOR and JSON data structures.\" As of 2019-06-12, it is published as RFC 8610 (Proposed Standard) at [https://tools.ietf.org/html/rfc8610](https://tools.ietf.org/html/rfc8610).\n\nThis crate includes a handwritten parser and lexer for CDDL, and its development has been heavily inspired by the techniques outlined in Thorsten Ball's book [\"Writing An Interpretor In Go\"](https://interpreterbook.com/). The AST has been built to closely match the rules defined by the ABNF grammar in [Appendix B.](https://tools.ietf.org/html/rfc8610#appendix-B) of the spec. All CDDL must use UTF-8 for its encoding per the spec.\n\nThis crate supports validation of both CBOR and JSON data structures. The minimum supported Rust version (MSRV) is 1.81.0.\n\nAlso bundled into this repository is a basic language server implementation and extension for Visual Studio Code for editing CDDL. The implementation is backed by the compiled WebAssembly target included in this crate.\n\n## Goals\n\n* [x] Parse CDDL documents into an AST\n* [x] Verify conformance of CDDL documents against RFC 8610\n* [x] Validate CBOR data structures\n* [x] Validate JSON documents\n* [ ] Generate dummy JSON from conformant CDDL\n* [x] As close to zero-copy as possible\n* [x] Compile WebAssembly target for browser and Node.js\n* [x] `no_std` support (lexing and parsing only)\n* [x] Language server implementation and Visual Studio Code Extension\n\n## Non-goals\n\n* Performance (if this crate gains enough traction, it may be prudent to conduct more formal profiling and/or explore using a parser-combinator framework like [nom](https://github.com/Geal/nom))\n* Support CBOR diagnostic notation\n* I-JSON compatibility\n\n## Why Rust?\n\nRust is a systems programming language designed around safety and is ideally-suited for resource-constrained systems. CDDL and CBOR are designed around small code and message sizes and constrained nodes, scenarios for which Rust has also been designed.\n\n## CLI\n\nA CLI is available for various platforms. The tool supports parsing of CDDL files for verifying conformance against RFC 8610. It can also be used to validate JSON documents and CBOR binary files against CDDL documents. Detailed information about the JSON and CBOR validation implementation can be found in the sections below.\n\n### Installation\n\n#### GitHub Releases\n\nBinaries for Linux, macOS and Windows can be downloaded from GitHub [Releases](https://github.com/anweiss/cddl/releases).\n\n#### Cargo\n\n```sh\ncargo install cddl\n```\n\n#### Docker\n\n```sh\ndocker pull ghcr.io/anweiss/cddl-cli:latest\n```\n\n### CLI usage\n\nInstructions for using the tool can be viewed by executing the `help` subcommand:\n\n```sh\ncddl help\n```\n\nIf using Docker:\n\n\u003e Replace `\u003cversion\u003e` with an appropriate [release](https://github.com/anweiss/cddl/releases) tag. Requires use of the `--volume` argument for mounting CDDL documents into the container when executing the command. JSON or CBOR files can either be included in the volume mount or passed into the command via STDIN.\n\n```sh\ndocker run -it --rm -v $PWD:/cddl -w /cddl ghcr.io/anweiss/cddl-cli:\u003cversion\u003e help\n```\n\nYou can validate JSON documents and/or CBOR binary files:\n\n```sh\ncddl validate [OPTIONS] --cddl \u003cCDDL\u003e \u003c--stdin|--json \u003cJSON\u003e...|--cbor \u003cCBOR\u003e...\u003e\n```\n\nIt also supports validating files from STDIN (if it detects the input as valid UTF-8, it will attempt to validate the input as JSON, otherwise it will treat it as CBOR):\n\n```sh\ncat reputon.json | cddl validate --cddl reputon.cddl --stdin\ncat reputon.cbor | cddl validate --cddl reputon.cddl --stdin\n```\n\nor using Docker:\n\n```sh\ndocker run -i --rm -v $PWD:/data -w /data ghcr.io/anweiss/cddl-cli:0.10.1 validate --cddl reputon.cddl --stdin \u003c reputon.json\n```\n\n## Website\n\nYou can also find a simple RFC 8610 conformance tool at [https://cddl.anweiss.tech](https://cddl.anweiss.tech). This same codebase has been compiled for use in the browser via WebAssembly.\n\n## Visual Studio Code extension\n\nAn extension for editing CDDL documents with Visual Studio Code has been published to the Marketplace [here](https://marketplace.visualstudio.com/items?itemName=anweiss.cddl-languageserver). You can find more information in the [README](cddl-lsp/README.md).\n\n## Supported features\n\n* [x] maps\n  + [x] structs\n  + [x] tables\n  + [x] cuts\n* [x] groups\n* [x] arrays\n* [x] values\n* [x] choices\n* [x] ranges\n* [x] enumeration (building a choice from a group)\n* [x] root type\n* [x] occurrence\n* [x] predefined types\n* [x] tags\n* [x] unwrapping\n* [x] controls\n* [x] socket/plug\n* [x] generics\n* [x] operator precedence\n* [x] comments\n* [x] numerical int/uint values\n* [x] numerical hexfloat values\n* [x] numerical values with exponents\n* [x] unprefixed byte strings\n* [x] prefixed byte strings\n\n## Usage\n\nSimply add the dependency to `Cargo.toml` :\n\n```toml\n[dependencies]\ncddl = \"0.10.1\"\n```\n\nBoth JSON and CBOR validation require `std` .\n\n### Feature flags\n\nA few convenience features have been included to make the AST more concise and for enabling additional functionality. You can build with `default-features = false` for a `no_std` build and selectively enable any of the features below.\n\n**`--feature ast-span`**\n\nAdd the `Span` type to the AST for keeping track of the position of the lexer and parser. Enabled by default.\n\n**`--feature ast-comments`**\n\nInclude comment strings in the AST. Enabled by default.\n\n**`--feature ast-parent`**\n\nAdd the `ParentVisitor` implementation so that the AST can be traversed using parent pointers. Enabled by default.\n\n**`--feature json`**\n\nEnable JSON validation. Enabled by default.\n\n**`--feature cbor`**\n\nEnable CBOR validation. Enabled by default.\n\n**`--feature additional-controls`**\n\nEnable validation support for the additional control operators defined in [RFC 9165](https://datatracker.ietf.org/doc/html/rfc9165). Enabled by default.\n\n### Parsing CDDL\n\n```rust\nuse cddl::parser::cddl_from_str;\n\nlet input = r#\"myrule = int\"#;\nassert!(cddl_from_str(input, true).is_ok())\n```\n\n### Validating JSON\n\n```rust\nuse cddl::validate_json_from_str;\n\nlet cddl = r#\"person = {\n  name: tstr,\n  age: uint,\n  address: tstr,\n}\"#;\n\nlet json = r#\"{\n  \"name\": \"John\",\n  \"age\": 50,\n  \"address\": \"1234 Lakeshore Dr\"\n}\"#;\n\nassert!(validate_json_from_str(cddl, json).is_ok())\n```\n\nThis crate uses the [Serde](https://serde.rs/) framework, and more specifically, the [serde_json](https://crates.io/crates/serde_json) crate, for parsing and validating JSON. Serde was chosen due to its maturity in the ecosystem and its support for serializing and deserializing CBOR via the [ciborium](https://crates.io/crates/ciborium) crate.\n\nAs outlined in [Appendix E.](https://tools.ietf.org/html/rfc8610#appendix-E) of the standard, only the JSON data model subset of CBOR can be used for validation. The limited prelude from the spec has been included below for brevity:\n\n```cddl\nany = #\n\nuint = #0\nnint = #1\nint = uint / nint\n\ntstr = #3\ntext = tstr\n\nnumber = int / float\n\nfloat16 = #7.25\nfloat32 = #7.26\nfloat64 = #7.27\nfloat16-32 = float16 / float32\nfloat32-64 = float32 / float64\nfloat = float16-32 / float64\n\nfalse = #7.20\ntrue = #7.21\nbool = false / true\nnil = #7.22\nnull = nil\n```\n\nFurthermore, the following data types from the standard prelude can be used for validating JSON strings and numbers:\n\n```cddl\ntdate = #6.0(tstr)\nuri = #6.32(tstr)\nb64url = #6.33(tstr)\ntime = #6.1(number)\n```\n\nThe first non-group rule defined by a CDDL data structure definition determines the root type, which is subsequently used for validating the top-level JSON data type.\n\n#### Supported JSON validation features\n\nThe following types and features of CDDL are supported by this crate for validating JSON:\n\n| CDDL                   | JSON                                                        |\n| ---------------------- | ----------------------------------------------------------- |\n| structs                | objects                                                     |\n| arrays                 | arrays\u003csup\u003e[1](#arrays)\u003c/sup\u003e                               |\n| `text / tstr` | string                                                      |\n| `uri` | string (valid RFC3986 URI)                                  |\n| `tdate` | string (valid RFC3339 date/time)                            |\n| `b64url` | string (base64url-encoded)                                  |\n| `time` | number (valid UNIX timestamp integer in seconds)            |\n| `number / int / float` | number\u003csup\u003e[2](#number)\u003c/sup\u003e                               |\n| `bool / true / false` | boolean                                                     |\n| `null / nil` | null                                                        |\n| `any` | any valid JSON                                              |\n| byte strings           | not yet implemented                                         |\n| unwrap ( `~` )           | any JSON that matches unwrapped type from map, array or tag |\n\nCDDL groups, generics, sockets/plugs and group-to-choice enumerations can all be used when validating JSON.\n\nSince JSON objects only support keys whose types are JSON strings, when validating JSON, member keys defined in CDDL structs must use either the colon syntax ( `mykey: tstr` or `\"mykey\": tstr` ) or the double arrow syntax provided that the member key is either a text string value ( `\"mykey\" =\u003e tstr` ) or a bareword that resolves to either a string data type ( `text` or `tstr` ) or another text string value ( `* tstr =\u003e any` ).\n\nOccurrence indicators can be used to validate key/value pairs in a JSON object and the number of elements in a JSON array; depending on how the indicators are defined in a CDDL data definition.\n\nBelow is the table of supported control operators:\n\n| Control operator | Supported                                                                                                                                                                                   |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `.pcre` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e\u003csup\u003e[3](#regex)\u003c/sup\u003e                     |\n| `.regex` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e\u003csup\u003e[3](#regex)\u003c/sup\u003e (alias for `.pcre` ) |\n| `.size` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.bits` | Ignored when validating JSON                                                                                                                                                                |\n| `.cbor` | Ignored when validating JSON                                                                                                                                                                |\n| `.cborseq` | Ignored when validating JSON                                                                                                                                                                |\n| `.within` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.and` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.lt` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.le` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.gt` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.ge` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.eq` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.ne` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n| `.default` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e                                           |\n\n\u003ca name=\"arrays\"\u003e1\u003c/a\u003e: When groups with multiple group entries are used to validate arrays, occurrence indicators are \"greedy\" in that only the first occurrence indicator that is come across is used in the validation. Subsequent entries with occurrence indicators are ignored due to complexities involved with processing these ambiguities. For proper JSON validation, avoid writing CDDL that looks like the following: `[ * a: int, b: tstr, ? c: int ]` .\n\n\u003ca name=\"number\"\u003e2\u003c/a\u003e: While JSON itself does not distinguish between integers and floating-point numbers, this crate does provide the ability to validate numbers against a more specific numerical CBOR type, provided that its equivalent representation is allowed by JSON. Refer to [Appendix E.](https://tools.ietf.org/html/rfc8610#appendix-E) of the standard for more details on the implications of using CDDL with JSON numbers.\n\n\u003ca name=\"regex\"\u003e3\u003c/a\u003e: Due to Perl-Compatible Regular Expressions (PCREs) being more widely used than XSD regular expressions, this crate also provides support for the proposed `.pcre` control extension in place of the `.regexp` operator (see [Discussion](https://tools.ietf.org/html/rfc8610#section-3.8.3.2) and [CDDL-Freezer proposal](https://tools.ietf.org/html/draft-bormann-cbor-cddl-freezer-03#section-5.1)). Ensure that your regex string is properly JSON escaped when using this control.\n\nIf you've enabled the `additional-controls` feature, the table of controls below is also available for use:\n\n| Control operator | Supported                                                                                                                                         |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `.plus` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.cat` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.det` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.abnf` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.abnfb` | Ignored when validating JSON                                                                                                                      |\n| `.feature` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n\nYou can activate features during validation as follows:\n\n```rust\nuse cddl::validate_json_from_str;\n\nlet cddl = r#\"\n  v = JC\u003c\"v\", 2\u003e\n  JC\u003cJ, C\u003e =  C .feature \"cbor\" / J .feature \"json\"\n\"#;\n\nlet json = r#\"\"v\"\"#;\n\nassert!(validate_json_from_str(cddl, json, Some(\u0026[\"json\"])).is_ok())\n```\n\n#### Comparing with JSON schema and JSON schema language\n\n[CDDL](https://tools.ietf.org/html/rfc8610), [JSON schema](https://json-schema.org/) and [JSON schema language](https://tools.ietf.org/html/draft-json-schema-language-02) can all be used to define JSON data structures. However, the approaches taken to develop each of these are vastly different. A good place to find past discussions on the differences between these formats is the [IETF mail archive](https://mailarchive.ietf.org/arch/), specifically in the JSON and CBOR lists. The purpose of this crate is not to argue for the use of CDDL over any one of these formats, but simply to provide an example implementation in Rust.\n\n### Validating CBOR\n\n```rust\nuse cddl::validate_cbor_from_slice;\n\nlet cddl = r#\"rule = false\"#;\n\nlet cbor = b\"\\xF4\";\n\nassert!(validate_cbor_from_slice(cddl, cbor).is_ok())\n```\n\nThis crate also uses [Serde](https://serde.rs/) and [ciborium](https://crates.io/crates/ciborium) for validating CBOR data structures. CBOR validation is done via the loosely typed [ `ciborium::value::Value` ](https://github.com/enarx/ciborium/blob/main/ciborium/src/value/mod.rs#L22) enum. In addition to all of the same features implemented by the JSON validator, this crate also supports validating CBOR tags (e.g. `#6.32(tstr)` ), CBOR major types (e.g. `#1.2` ), table types (e.g. `{ [ + tstr ] =\u003e int }` ) and byte strings. The `.bits` , `.cbor` and `.cborseq` control operators are all supported as well.\n\nThe following tags are supported when validating CBOR:\n\n| Tag                                      | Supported                                                                                                                                         |\n| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `tdate = #6.0(tstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `time = #6.1(number)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `biguint = #6.2(bstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `bignint = #6.3(bstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `decfrac = #6.4([e10: int, m: integer])` | not yet implemented                                                                                                                               |\n| `bigfloat = #6.5([e2: int, m: integer])` | not yet implemented                                                                                                                               |\n| `eb64url = #6.21(any)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `eb64legacy = #6.22(any)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `eb16 = #6.23(any)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `encoded-cbor = #6.24(bstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `uri = #6.32(tstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `b64url = #6.33(tstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `b64legacy = #6.34(tstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `regexp = #6.35(tstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `mime-message = #6.36(tstr)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `cbor-any = #6.55799(any)` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n\nIf you've enabled the `additional-controls` feature, the table of controls below is also available for use:\n\n| Control operator | Supported                                                                                                                                         |\n| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `.plus` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.cat` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.det` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.abnf` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.abnfb` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n| `.feature` | \u003cg-emoji class=\"g-emoji\" alias=\"heavy_check_mark\" fallback-src=\"https://github.githubassets.com/images/icons/emoji/unicode/2714.png\"\u003e✔️\u003c/g-emoji\u003e |\n\nYou can activate features during validation by passing a slice of feature strings as follows:\n\n```rust\nuse cddl::validate_cbor_from_slice;\n\nlet cddl = r#\"\n  v = JC\u003c\"v\", 2\u003e\n  JC\u003cJ, C\u003e =  C .feature \"cbor\" / J .feature \"json\"\n\"#;\n\nlet cbor = b\"\\x02\";\n\nassert!(validate_cbor_from_slice(cddl, cbor, Some(\u0026[\"cbor\"])).is_ok())\n```\n\n## `no_std` support\n\nOnly the lexer and parser can be used in a `no_std` context provided that a heap allocator is available. This can be enabled by opting out of the default features in your `Cargo.toml` file as follows:\n\n```toml\n[dependencies]\ncddl = { version = \"0.10.1\", default-features = false }\n```\n\nZero-copy parsing is implemented to the extent that is possible. Allocation is required for error handling and diagnostics.\n\nBoth JSON and CBOR validation are dependent on their respective heap allocated `Value` types, but since these types aren't supported in a `no_std` context, they subsequently aren't supported by this crate in `no_std` .\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanweiss%2Fcddl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanweiss%2Fcddl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanweiss%2Fcddl/lists"}