6 releases
| new 0.3.0 | Feb 4, 2026 |
|---|---|
| 0.2.2 | Jun 26, 2025 |
| 0.2.1 | May 26, 2025 |
| 0.2.0 | Apr 25, 2025 |
| 0.1.1 | Apr 25, 2025 |
#212 in No standard library
69KB
611 lines
Implement NonZeroChar, wrapped NonZero<char>
- Implemented of all char stable methods (most of forwarding)
Examples
use nonzero_char::NonZeroChar;
assert_eq!(NonZeroChar::new('a').unwrap(), 'a');
assert_eq!(NonZeroChar::new('\0'), None);
Null Pointer Optimization:
use nonzero_char::NonZeroChar;
assert_eq!(size_of::<NonZeroChar>(), size_of::<Option<NonZeroChar>>());