35 lines
1.1 KiB
Markdown
35 lines
1.1 KiB
Markdown
# Features
|
|
|
|
Decodal keeps the embedded core small by making heavy functionality opt-in.
|
|
|
|
## Core defaults
|
|
|
|
`decodal-core` defaults to `std` only.
|
|
|
|
```toml
|
|
[features]
|
|
default = ["std"]
|
|
std = []
|
|
regex = ["std", "dep:regex"]
|
|
```
|
|
|
|
Building `decodal-core` with `--no-default-features` keeps the core in `no_std + alloc` mode and avoids optional dependencies.
|
|
|
|
## Regex
|
|
|
|
Regex constraints are implemented behind the `regex` feature.
|
|
When the feature is disabled, regex constraints parse and compose, but validating a concrete value against them returns an unsupported feature diagnostic.
|
|
|
|
```sh
|
|
cargo run -q -p decodal --features regex -- examples/regex/main.dcdl
|
|
```
|
|
|
|
Regex constraints are accumulated during `&` composition.
|
|
The implementation does not try to prove whether the intersection of two regex constraints is empty.
|
|
Concrete strings must match every regex constraint attached to the abstract value.
|
|
|
|
## CLI features
|
|
|
|
`decodal-cli` exposes a matching `regex` feature that enables `decodal-core/regex`.
|
|
The feature is not enabled by default so the default CLI binary remains small.
|