Twine is a simple data serialization format that allows you to share data across different systems.
Twine was developed with the purpose of being extensible and easy to implement.
Twine is currently available in the following languages:
Data in twine files is stored in data structures. Data sturctures have different
types, such as int
, float
, and str
.
Each data structure also has a subtype. This contains additional information like
the precision of a float
, or the length of an int
in bytes.
For a full list of types and subtypes, please refer to the types reference
The handler of a type can also require some arguments. For example a list
may require an argument specifying it’s length
Here’s how a list
containing 13 elements might be encoded:
1--- 2--- 3------------------ 4---
a--- b--- c--------
0101 0000 0010 0001 0000 1101 ....
Where:
0101
indicates that it is a list0000
is the subtype for the list0010 0001 0000 1101
is the length argument for the list:
0010
indicates that the argument is an int0001
is the subtype, and indicates an 8-bit unsigned integer0000 1101
contains the data of the int, and indicates the number 13....
the succeeding bytes contain the data of the list