Crates.io | smol-base-x |
lib.rs | smol-base-x |
version | 0.1.0 |
source | src |
created_at | 2022-07-04 03:29:44.9793 |
updated_at | 2022-07-04 03:29:44.9793 |
description | no-std centric implementation of base-x |
homepage | |
repository | https://github.com/mriise/smol-base-x |
max_upload_size | |
id | 618694 |
size | 57,101 |
This requires a nightly compiler to use the array API.
Features used under the 'unstable' flag:
Implementing a new Alphabet is rather simple:
use smol_base_x::*;
pub struct Base58 {}
impl Base<58> for Base58 {
const ALPHABET: [u8; 58] = *b"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
}
Implementing Base
will automatically generate a 256 byte LUT, which was chosen over a match statement based off of benchmarks in benches/lut_vs_matches
this lib provides a macro under unstable for generating a match statement equivalent to a LUT, but is mostly useful for when dealing with non-ascii alphabets (which are currently unmaintained).