#codec #encoding #decoding #endianness #endian

endicon

Implementations of codicon traits for endianness encodings

1 stable release

1.0.0 Oct 10, 2018

#40 in Encoding

Download history 6/week @ 2018-10-11 9/week @ 2018-10-18 3/week @ 2018-10-25 4/week @ 2018-11-01 9/week @ 2018-11-08 5/week @ 2018-11-15 1/week @ 2018-11-22

6 downloads per month

Apache-2.0

8KB
106 lines

Build Status Rust Version 1.28+ Crate Docs

Endicon implements the codicon crate traits for doing endianness-based encoding and decoding on integers. See the documentation for full details.

Install

Run this command:

$ cargo add endicon

lib.rs:

Implements endianness encodings using the codicon traits.

See the codicon crate for details.

Examples

extern crate codicon;
extern crate endicon;

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);

Dependencies

~7KB