A library for transcoding between hexadecimal strings in Astro Notation Format and Native Rust data types.
In your Cargo.toml
:
```
[dependencies] astro-notation = "1.2.0"
```
In your Rust file:
```
use astro_notation::{encode, decode};
```
| Type | Support | |---|---| | str | ✅ | | u8 | ✅ | | u16 | ✅ | | u32 | ✅ | | u64 | ✅ | | u128 | ✅ | | i8 | 🚧 | | i16 | 🚧 | | i32 | 🚧 | | i64 | 🚧 | | i128 | 🚧 | | f32 | 🚧 | | f64 | 🚧 | | bool | ✅ | | list | ✅ | | bytes | ✅ |
Boolean
```
let astro_bool: String = encode::bool(&true);
let decodedbool: bool = decode::asbool(&astro_bool);
```
String
```
let str: String = "hello".to_string();
let astro_str: String = encode::str(&int);
let decodedstr: String = decode::asu8(&astro_str);
```
Unsigned Integers
```
let astrou8: String = encode::u8(&8u8);
let decodedu8: u8 = decode::asu8(&astro_u8);
```
Bytes
```
let bytes: Vec
let astro_bytes: String = encode::bytes(&bytes);
let decodedbytes: Vec
```
List
```
let list: Vec
let astro_list: String = encode::list(&list);
let decodedlist: Vec
```
HashMap
```
let hmap: HashMap
let astro_hmap: String = encode::hashmap(&hmap);
let decodedhmap: HashMap
```
Pull requests, bug reports and any kind of suggestion are welcome.
2022-02-04