17 releases
Uses new Rust 2024
| 0.3.7 | Sep 4, 2025 |
|---|---|
| 0.3.6 | Sep 2, 2025 |
| 0.3.2 | Aug 30, 2025 |
| 0.2.8 | Aug 29, 2025 |
| 0.1.1 | Aug 23, 2025 |
#607 in Algorithms
789 downloads per month
120KB
4.5K
SLoC
!!! This crate is not stable yet. !!!
Reliq
A Numeric & Data Structure Toolkit designed for Portability.
A lightweight, no_std compatible library providing fixed-capacity arrays, UTF-8 strings, fixed-precision numeric types, and a generic numeric trait hierarchy. It is designed for portability where heap allocation may be undesirable, and predictablee arithmetic behaviour is required.
Fixed-Capacity Arrays
- `Array<const A: usize, B> -- stack-allocated, compile-time sized array.
- Supports:
push,pop,insert,remove.swap_insert/swap_removefor unordered collections.- Conversion to slices
as_slice,as_mut_slice, and iteration.
let mut arr: Array<4, u8> = Array::default();
arr.push(1).unwrap();
arr.push(2).unwrap();
arr.swap_insert(0, 5).unwrap();
assert_eq!(arr.len(), 3);
UTF-8
Utf8<const A: usize>-- fixed-capacity Utf8 string.- Supports safe
push/popofchar, casting between capacities, and encoding/decoding from byte slices. - Implements
Display,Debug,PartialEq,Eq,Ord, andPartialOrd.
let mut s: Utf8<16> = Utf8::default();
s.push('H').unwrap();
s.push('i').unwrap();
assert_eq!(s.as_str(), "Hi");
Example
let mut value = 0;
let result = require(&mut value, |v| {
*v += 1;
Err("rollback")
});
assert_eq!(value, 0);
License
Apache-2.0
What the app wants, not what is uses.
Dependencies
~0.4–1MB
~22K SLoC