Compact data format and streaming codec that's easy to embed on any platform, from web apps to robots.
What's a Pact?
A pact describes the structure of related groups of data called entries, each containing one or more fields.
Pact entries can have the following kinds of fields:
- Unsigned integers from
8to64bits (u8,u16,u32, andu64). - Signed integers from
8to64bits (i8,i16,i32, andi64). - Signed floating-point integers from
32to64bits (f32andf64). - Booleans (
boolean). - Variable-length strings (
string). - Nested entries.
- Arrays of any of the things listed above.
For information on how pact data is coded to and
from binary data, refer to the codec docs.
How do I make a Pact?
Pacts are made using TOML:
## An example pact.
= 'MyGreeter'
## A group of data in this
## pact named 'Request'.
[]
= 'string'
## Another group of data
## in this pact named
## 'Response'.
[]
= 'string'
## This field of Response is an
## array of strings, instead of just
## a single string, because it is
## surrounded by `[]`.
= ['string']
This TOML describes the MyGreeter pact, and declares
two kinds of entries: Request and Response. Both entries
contain a variable-length message string, and the
Response entry contains an array of strings
called friends.
Every entry description starts with a number called
an Ordinal. Ordinals uniquely identify the different
kinds of entries in the same pact. The first entry described
by a pact always has ordinal 1, and each additional entry
in the same pact has an ordinal that is one higher
than the previous data.
Comments that start with ## and come immediately
before the pact name, a entry name, or a field
name, will be parsed as documentation for the item
they precede.
License
Copyright 2024 Alicorn Systems, Inc.
Licensed under the GNU Affero General Public License version 3, as published by the Free Software Foundation. Refer to the license file for more information.
If you have any questions, please reach out to [hello@alicorn.systems].