#ast #gadt #encoding #rgb-strict-encoding

bin+lib rgb-strict-types

Strict types: confined generalized algebraic data types (GADT)

2 releases (1 stable)

1.0.0 Nov 27, 2025
0.1.0 Nov 26, 2025

#605 in Math

Download history 84/week @ 2025-11-24 2/week @ 2025-12-08 10/week @ 2025-12-15 8/week @ 2025-12-22 5/week @ 2025-12-29 10/week @ 2026-01-05 105/week @ 2026-01-12 22/week @ 2026-01-19 71/week @ 2026-01-26 140/week @ 2026-02-02 114/week @ 2026-02-09 82/week @ 2026-02-16 246/week @ 2026-02-23

589 downloads per month
Used in 7 crates (6 directly)

Apache-2.0

280KB
6K SLoC

Strict types AST and typelib implementation

Protobufs for functional programming

This is a set of libraries for working with abstract syntax trees and libraries of strict types – type system made with category theory which ensures provable properties and bounds for the in-memory and serialized type representation.

Strict types is a formal notation for defining and serializing generalized algebraic data types (GADT) in a deterministic and confined way. It is developed with type theory in mind.

Strict Types are:

  • schema-based (with the schema being strict encoding notation),
  • semantic, i.e. defines types not just as they are layed out in memory, but also depending on their meaning,
  • deterministic, i.e. produces the same result for a given type,
  • portabile, i.e. can run on ahy hardware architecture and OS, including low-performant embedded systems,
  • confined, i.e. provides guarantees and static analysis on a maximum size of the typed data,
  • formally verifiabile.

To learn more about strict encoding read the spec.

Strict types works with type definitions. It allows:

  • static analysis of data types, like
    • defining semantic type ids;
    • specifying exact memory layout;
    • type equivalence in terms of semantics and memory layout;
    • size of serialized data
  • composing types into type libraries;
  • versioning type libraries basing on the semantic types;

The library allows to generate & compile strict type libraries (STL) from rust types implementing StrictEncoding trait -- and ensures that the deserialization with StrictDecode follows the same memory and semantic layout.

Contributing

CONTRIBUTING.md

Dependencies

~12MB
~199K SLoC