Crates.io | endicon |
lib.rs | endicon |
version | 3.0.0 |
source | src |
created_at | 2018-10-10 17:28:45.705948 |
updated_at | 2020-09-07 20:09:09.327417 |
description | Implementations of codicon traits for endianness encodings |
homepage | |
repository | https://github.com/psilocybin/endicon |
max_upload_size | |
id | 89104 |
size | 21,826 |
Implements endianness encodings using the codicon
traits.
See the codicon
crate for details.
use endicon::Endianness;
use codicon::Encoder;
let mut bytes = [0u8; 2];
let little = [1u8, 0u8];
let big = [0u8, 1u8];
1u16.encode(&mut bytes.as_mut(), Endianness::Little).unwrap();
assert_eq!(bytes, little);
1u16.encode(&mut bytes.as_mut(), Endianness::Big).unwrap();
assert_eq!(bytes, big);
License: Apache-2.0