vds
Visibly Distinguishable Strings โ a #![no_std] Rust crate for creating and validating string identifiers composed of easily readable characters.
This crate helps you generate and work with strings that:
- Exclude confusing glyphs like
O,0,I,1 - Use only uppercase Latin letters and select digits
- Are safe for UI display, voice transmission, QR encoding, and more
๐ Getting Started
Install via Cargo:
Enable optional features:
serdeโ enablesSerialize/DeserializeforVDCharandVDStringgenerateโ adds a builder for random string generation usingrand_core
[]
= { = "1.0", = ["generate", "serde"] }
๐ฏ Types
VDChar
A single, clearly readable character from a curated set.
use VDChar;
assert!;
assert!; // O is excluded
VDString
A validated string composed of VDChars. Acts like &str and supports .parse(), indexing, and iteration.
use VDString;
let code: VDString = "AB29XY".parse.unwrap;
assert_eq!;
VDGenerator (requires generate feature)
A builder for generating readable strings with optional constraints:
use VDGenerator;
use SeedableRng;
let mut rng = seed_from_u64;
let code = new
.length
.no_repeats
.no_adjacent_repeats
.generate
.unwrap;
๐งช Development & Testing
๐ Dev Commands
This repo includes a .cargo/config.toml file with helpful aliases:
cargo docsโ build and open full-featured docscargo testsโ run the full test suite with all featurescargo checksโ check build with no default featurescargo buildsโ build with all features enabled
๐ฆ Crate Metadata
- License: MIT OR Apache-2.0
- Repo: github.com/ianwillis98/vds
- Minimum Rust: 1.65
- No
stdrequired
๐ License
Licensed under either of:
- MIT OR Apache-2.0