array-bytes
Collection of Array/Bytes/Hex Utilities.
Abilities
TryFromHex Trait
- Convert
HextoNum- 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
- type
bytes Prefixed Functions
- Convert
BytestoHex- type
&[u8] -> String
- type
hex Prefixed Functions
- Build fixed length
ArrayfromHex- type
&str -> [u8; N]
- type
- Convert
HextoBytes- type
&str -> Vec<u8>
- type
- Transform
HextoT- type
&str -> T - e.g.
"0x..." -> [u8; 20] -> H160
- type
slice Prefixed Functions
- Build fixed length
ArrayfromSlice- type
&[T] -> [T; N]
- type
- Transform
SlicetoG- type
&[T] -> G - e.g.
&[0_u8, ...] -> [u8; 20] -> H160
- type
vec Prefixed Functions
- Build fixed length
ArrayfromVec- type
Vec<T> -> [T; N]
- type
- Transform
VectoG- type
Vec<T> -> G - e.g.
vec![0_u8, ...] -> [u8; 20] -> H160
- type
Serde Support (require feature serde)
#[serde(deserialize_with = "array_bytes::hex_deserialize_n_into")]- type
S -> T - e.g.
"0x..." -> H160
- type
#[serde(deserialize_with = "array_bytes::de_hex2num")]- type
S -> Num - e.g.
"0xA" -> 10_u32
- type
#[serde(deserialize_with = "array_bytes::de_hex2bytes")]- type
S -> Vec<u8> - e.g.
"0x00" -> vec![0_u8]
- type