nobcd

Crates.ionobcd
lib.rsnobcd
version0.2.0
sourcesrc
created_at2023-02-03 08:34:21.171174
updated_at2023-04-24 11:04:07.012239
descriptionA simple BCD number primitive for no_std environments
homepage
repositoryhttps://github.com/rmja/nobcd
max_upload_size
id775446
size9,275
Rasmus Melchior Jacobsen (rmja)

documentation

README

A simple BCD number primitive

CI crates.io

This crate provides a simple BcdNumber type that can be used in embedded no_std environments.

If you are missing a feature, please raise an issue or a PR.

Example

let bcd = BcdNumber::<2>::try_new(1234u16).unwrap();
assert_eq!(1234u16, bcd.value());
assert_eq!([0x12, 0x34], bcd.bcd_bytes());
assert_eq!(bcd, BcdNumber::try_from([0x12, 0x34]).unwrap());
Commit count: 27

cargo fmt