The Rust Implementation of Stellar Notation, a data encoding library.
```
stellar-notation = "0.9.13"
```
```
use stellar_notation::{ encoding, decoding };
```
Encoding and Decoding Values between Hex for u128 and bytes.
```
let encoded_u128: String = encoding::u128(1);
let u128number: u128 = decoding::as128(encoded_u128);
```
```
let encoded_bytes: String = encoding::bytes(vec![1,2,3]);
let bytes: Vec
```
An Object is a Key-Value tuple of UTF-8 Strings.
```
let key: String = String::from("key1"); let value: String = String::from("value1");
let object_buffer: Vec
```
| Value | Key Length | Key Bytes | Value Length Size | Value Length | Value Data | |---|---|---|---|---|---| | Size(bytes) | 1 | max. 255 | 1 | 1,2,4,8 | max. ~18.45exa |
Value data is also limited by the system file size limit.
Decodes bytes into a Key Value String tuple.
```
let object: (String, String) = decoding::object(object_buffer);
```
Converts a group of objects into bytes.
```
let group: Vec<(String, String)> = vec![ object1, object2, object3 ]
let groupbuffer: Vec
```
| Group | | --- | | Obj1, Obj2 ... Obj(n) |
Reconverts bytes into a group of objects.
```
let group: Vec<(String, String)> = decoding::group(group_buffer);
```
2021-09-10