|
4 | 4 | <!-- ![array-bytes]() -->
|
5 | 5 |
|
6 | 6 | # array-bytes
|
7 |
| -### Collection of Array/Bytes/Hex Utilities. |
| 7 | +### A Collection of Array/Bytes/Hex Utilities. |
8 | 8 |
|
9 | 9 | [](https://www.gnu.org/licenses/gpl-3.0)
|
10 | 10 | [](https://github.com/hack-ink/array-bytes/actions/workflows/checks.yml)
|
|
16 | 16 | </div>
|
17 | 17 |
|
18 | 18 | ## Abilities
|
19 |
| -#### `TryFromHex` Trait |
| 19 | +#### `TryFromHex` trait |
20 | 20 | - Convert `Hex` to `Num`
|
21 | 21 | - type `&str -> isize`
|
22 | 22 | - type `&str -> i8`
|
|
31 | 31 | - type `&str -> u64`
|
32 | 32 | - type `&str -> u128`
|
33 | 33 |
|
34 |
| -#### `bytes` Prefixed Functions |
| 34 | +#### `bytes` prefixed functions |
35 | 35 | - Convert `Bytes` to `Hex`
|
36 | 36 | - type `&[u8] -> String`
|
37 | 37 |
|
38 |
| -#### `hex` Prefixed Functions |
| 38 | +#### `hex` prefixed functions |
39 | 39 | - Convert `HexBytes` to `Hex`
|
40 | 40 | - type `&[u8] -> &str`
|
41 | 41 | - e.g. `b"0x..." -> "0x..."`
|
|
47 | 47 | - type `&str -> T`
|
48 | 48 | - e.g. `"0x..." -> [u8; 20] -> H160`
|
49 | 49 |
|
50 |
| -#### `slice` Prefixed Functions |
| 50 | +#### `slice` prefixed functions |
51 | 51 | - Build fixed length `Array` from `Slice`
|
52 | 52 | - type `&[T] -> [T; N]`
|
53 | 53 | - Transform `Slice` to `G`
|
54 | 54 | - type `&[T] -> G`
|
55 | 55 | - e.g. `&[0_u8, ...] -> [u8; 20] -> H160`
|
56 | 56 |
|
57 |
| -#### `vec` Prefixed Functions |
| 57 | +#### `vec` prefixed functions |
58 | 58 | - Build fixed length `Array` from `Vec`
|
59 | 59 | - type `Vec<T> -> [T; N]`
|
60 | 60 | - Transform `Vec` to `G`
|
61 | 61 | - type `Vec<T> -> G`
|
62 | 62 | - e.g. `vec![0_u8, ...] -> [u8; 20] -> H160`
|
63 | 63 |
|
64 |
| -#### Serde Support (require feature `serde`) |
| 64 | +#### Serde support (require feature `serde`) |
65 | 65 | - `#[serde(deserialize_with = "array_bytes::hex_deserialize_n_into")]`
|
66 | 66 | - type `S -> T`
|
67 | 67 | - e.g. `"0x..." -> H160`
|
|
72 | 72 | - type `S -> Vec<u8>`
|
73 | 73 | - e.g. `"0x00" -> vec![0_u8]`
|
74 | 74 |
|
75 |
| -## Benchmark Results |
76 |
| -<div align="right"> |
77 |
| -<sub>Friday, September 9, 2022</sub> |
78 |
| -</div> |
| 75 | +## Benchmark results |
| 76 | +<div align="right"><sub>Friday, September 9, 2022</sub></div> |
79 | 77 |
|
80 | 78 | ```rs
|
81 | 79 | array_bytes::bytes2hex time: [37.577 µs 37.755 µs 37.914 µs]
|
|
0 commit comments