<div align="center">
# array-bytes
### Collection of Array/Bytes/Hex Utilities.
[](https://www.gnu.org/licenses/gpl-3.0)
[](https://github.com/hack-ink/array-bytes/actions/workflows/checks.yml)
[](https://github.com/hack-ink/array-bytes/tags)
[](https://github.com/hack-ink/array-bytes)
[](https://github.com/hack-ink/array-bytes)
</div>
## Abilities
> Full docs: https://docs.rs/array-bytes/latest/array_bytes
#### `TryFromHex` Trait
- Convert `Hex` to `Num`
- type `&str -> isize`
- type `&str -> i8`
- type `&str -> i16`
- type `&str -> i32`
- type `&str -> i64`
- type `&str -> i128`
- type `&str -> usize`
- type `&str -> u8`
- type `&str -> u16`
- type `&str -> u32`
- type `&str -> u64`
- type `&str -> u128`
#### `bytes` Prefixed Functions
- Convert `Bytes` to `Hex`
- type `&[u8] -> String`
#### `hex` Prefixed Functions
- Build fixed length `Array` from `Hex`
- type `&str -> [u8; N]`
- Convert `Hex` to `Bytes`
- type `&str -> Vec<u8>`
- Transform `Hex` to `T`
- type `&str -> T`
- e.g. `"0x..." -> [u8; 20] -> H160`
#### `slice` Prefixed Functions
- Build fixed length `Array` from `Slice`
- type `&[T] -> [T; N]`
- Transform `Slice` to `G`
- type `&[T] -> G`
- e.g. `&[0_u8, ...] -> [u8; 20] -> H160`
#### `vec` Prefixed Functions
- Build fixed length `Array` from `Vec`
- type `Vec<T> -> [T; N]`
- Transform `Vec` to `G`
- type `Vec<T> -> G`
- e.g. `vec![0_u8, ...] -> [u8; 20] -> H160`
#### Serde Support (require feature `serde`)
- `#[serde(deserialize_with = "array_bytes::hex_deserialize_n_into")]`
- type `S -> T`
- e.g. `"0x..." -> H160`
- `#[serde(deserialize_with = "array_bytes::de_hex2num")]`
- type `S -> Num`
- e.g. `"0xA" -> 10_u32`
- `#[serde(deserialize_with = "array_bytes::de_hex2bytes")]`
- type `S -> Vec<u8>`
- e.g. `"0x00" -> vec![0_u8]`