Crates.io | bitconv |
lib.rs | bitconv |
version | 0.1.4 |
source | src |
created_at | 2021-01-27 02:05:10.966528 |
updated_at | 2021-03-08 19:45:23.367909 |
description | A simple, zero-dependency, no_std compatible Rust equivalent to the C# BitConverter class. |
homepage | |
repository | https://github.com/inspier/bitconv |
max_upload_size | |
id | 347129 |
size | 20,589 |
A simple, zero-dependency, no_std compatible Rust equivalent to the C# BitConverter class.
To add to your Cargo.toml:
bitconv = "0.1.4"
use bitconv::{endian::{Big, Little, Native}, to_uint32};
fn main() {
let buffer = [15, 0, 0, 0, 0, 16, 0, 255, 3, 0, 0, 202, 19];
assert_eq!(261888, to_uint32::<Little>(&buffer, 6));
assert_eq!(261888, to_uint32::<Native>(&buffer, 6));
assert_eq!(16712448, to_uint32::<Big>(&buffer, 6));
}