Crates.io | array-bytes |
lib.rs | array-bytes |
version | 6.2.3 |
source | src |
created_at | 2020-11-23 02:57:58.740407 |
updated_at | 2024-05-16 13:55:48.662667 |
description | A collection of array/bytes/hex utilities. |
homepage | https://hack.ink/array-bytes |
repository | https://github.com/hack-ink/array-bytes |
max_upload_size | |
id | 315207 |
size | 103,498 |
TryFromHex
traitAsRef<[u8]> -> isize
AsRef<[u8]> -> i8
AsRef<[u8]> -> i16
AsRef<[u8]> -> i32
AsRef<[u8]> -> i64
AsRef<[u8]> -> i128
AsRef<[u8]> -> usize
AsRef<[u8]> -> u8
AsRef<[u8]> -> u16
AsRef<[u8]> -> u32
AsRef<[u8]> -> u64
AsRef<[u8]> -> u128
AsRef<[u8]> -> [u8; N]
, N = { [1, 64], 128, 256, 512 }
AsRef<[u8]> -> Vec<u8>
Hex
traitisize -> String
i8 -> String
i16 -> String
i32 -> String
i64 -> String
i128 -> String
usize -> String
u8 -> String
u16 -> String
u32 -> String
u64 -> String
u128 -> String
Vec<u8> -> String
[u8; N] -> String
, N = { [1, 64], 128, 256, 512 }
&[u8] -> String
slice
prefixed functionsArray
from Slice
&[T] -> [T; N]
&[T] -> &[T; N]
Slice
to G
&[T] -> G
&[0_u8, ...] -> [u8; 20] -> H160
prefix
and suffix
functionsN
.bytes
prefixed functionsAsRef<[u8]> -> String
hex
prefixed functionsHexBytes
to hex
&[u8] -> &str
b"0x..." -> "0x..."
Array
&str -> [u8; N]
AsRef<[u8]> -> Vec<u8>
Slice
AsRef<[u8]> -> &[u8]
T
AsRef<[u8]> -> T
"0x..." -> [u8; 20] -> H160
vec
prefixed functionsArray
from Vec
Vec<T> -> [T; N]
Vec
to G
Vec<T> -> G
vec![0_u8, ...] -> [u8; 20] -> H160
serde
)#[serde(deserialize_with = "array_bytes::hex_deserialize_n_into")]
S -> T
"0x..." -> H160
#[serde(deserialize_with = "array_bytes::de_hex2num")]
S -> Num
"0xA" -> 10_u32
#[serde(deserialize_with = "array_bytes::de_hex2bytes")]
S -> Vec<u8>
"0x00" -> vec![0_u8]
array_bytes::bytes2hex time: [30.487 µs 30.513 µs 30.543 µs]
change: [-12.758% -7.1673% -2.3095%] (p = 0.00 < 0.05)
Performance has improved.
Found 4 outliers among 100 measurements (4.00%)
3 (3.00%) high mild
1 (1.00%) high severe
const_hex::encode time: [2.1197 µs 2.2245 µs 2.3208 µs]
change: [+25.796% +31.010% +36.449%] (p = 0.00 < 0.05)
Performance has regressed.
faster_hex::hex_string time: [13.666 µs 13.711 µs 13.754 µs]
change: [-0.3508% +0.0892% +0.5043%] (p = 0.68 > 0.05)
No change in performance detected.
faster_hex::hex_encode_fallback
time: [13.476 µs 13.519 µs 13.564 µs]
change: [-0.1799% +0.2323% +0.6560%] (p = 0.27 > 0.05)
No change in performance detected.
Found 1 outliers among 100 measurements (1.00%)
1 (1.00%) high mild
hex::encode time: [133.99 µs 135.65 µs 137.13 µs]
change: [-1.6763% +0.2181% +2.1203%] (p = 0.82 > 0.05)
No change in performance detected.
Found 15 outliers among 100 measurements (15.00%)
13 (13.00%) low severe
2 (2.00%) low mild
rustc_hex::to_hex time: [118.83 µs 124.46 µs 129.51 µs]
change: [-3.5525% +2.8439% +10.307%] (p = 0.42 > 0.05)
No change in performance detected.
array_bytes::hex2bytes time: [46.892 µs 47.510 µs 48.195 µs]
change: [-8.2282% -6.5411% -4.6367%] (p = 0.00 < 0.05)
Performance has improved.
Found 6 outliers among 100 measurements (6.00%)
1 (1.00%) high mild
5 (5.00%) high severe
array_bytes::hex2bytes_unchecked
time: [73.450 µs 73.842 µs 74.251 µs]
change: [+0.5740% +1.3693% +2.1806%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 17 outliers among 100 measurements (17.00%)
11 (11.00%) low mild
5 (5.00%) high mild
1 (1.00%) high severe
array_bytes::hex2slice time: [57.825 µs 57.915 µs 58.007 µs]
change: [-0.9051% -0.6249% -0.3523%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 6 outliers among 100 measurements (6.00%)
6 (6.00%) high mild
array_bytes::hex2slice_unchecked
time: [73.574 µs 73.917 µs 74.281 µs]
change: [-4.9137% -4.1840% -3.4519%] (p = 0.00 < 0.05)
Performance has improved.
Found 13 outliers among 100 measurements (13.00%)
8 (8.00%) high mild
5 (5.00%) high severe
const_hex::decode time: [15.849 µs 15.887 µs 15.924 µs]
change: [-3.1788% -2.1280% -1.2019%] (p = 0.00 < 0.05)
Performance has improved.
faster_hex::hex_decode time: [31.735 µs 31.764 µs 31.800 µs]
change: [-0.7403% -0.5216% -0.2674%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
5 (5.00%) high mild
2 (2.00%) high severe
faster_hex::hex_decode_unchecked
time: [13.059 µs 13.098 µs 13.145 µs]
change: [-0.7125% -0.3968% -0.1100%] (p = 0.01 < 0.05)
Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
6 (6.00%) high mild
4 (4.00%) high severe
faster_hex::hex_decode_fallback
time: [13.074 µs 13.090 µs 13.108 µs]
change: [-1.9404% -1.5652% -1.1912%] (p = 0.00 < 0.05)
Performance has improved.
Found 9 outliers among 100 measurements (9.00%)
5 (5.00%) high mild
4 (4.00%) high severe
hex::decode time: [131.19 µs 132.57 µs 134.26 µs]
change: [+1.9126% +3.2801% +4.8702%] (p = 0.00 < 0.05)
Performance has regressed.
Found 15 outliers among 100 measurements (15.00%)
15 (15.00%) high severe
hex::decode_to_slice time: [57.577 µs 58.018 µs 58.447 µs]
change: [+0.0185% +1.1253% +2.2104%] (p = 0.04 < 0.05)
Change within noise threshold.
Found 2 outliers among 100 measurements (2.00%)
1 (1.00%) high mild
1 (1.00%) high severe
rustc_hex::from_hex time: [130.19 µs 130.86 µs 131.48 µs]
change: [-1.8542% -1.4374% -0.9862%] (p = 0.00 < 0.05)
Change within noise threshold.
Found 2 outliers among 100 measurements (2.00%)
2 (2.00%) high mild
Licensed under either of Apache-2.0 or GPL-3.0 at your option.