endiantype 0.1.3

endiantype is an no-std, endian-aware implementation of primitive types like u8, u16, etc.
Documentation
  • Coverage
  • 3%
    3 out of 100 items documented3 out of 75 items with examples
  • Size
  • Source code size: 15.44 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 32.87 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • jwnhy/endiantype
    2 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • jwnhy

Endian Type

Crate API

endiantype is an no-std, endian-aware implementation of primitive types like u8, u16, etc.

All endian types are implemented in a transparent way that it can directly replace the original types with almost zero overhead.

Usage

Add this to your Cargo.toml

endiantype = "0.1.3"

to use in a [no_std] environment, you need to disable default features.

endiantype = { version = "0.1.3", default-features = false}

and import endian-ware types from this crate.

use endiantype::types::*;

Features

Here is some features of endiantype crate.

[no-std] Support

This crate can be used without std support with no requirements or additional features needed as it only relies on core.

Drop-in replacement

This crate provides sufficient default operations for endian-aware types.

For example, you can directly compare a primitive type with a endian-aware type.

use endiantype::*;
let num_le = u16_le::from_native(10);
assert!(num_le < 11);

Other bit-wise ops like &, | and arithmetic ops like +, - are also supported.

use endiantype::*;
let a = u32_le::from_native(1);
let b = u32_be::from_native(2);
assert!(a+b == 3);