assert_size 0.1.1

A macro to assert that a type has a specific size at compile time
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented2 out of 2 items with examples
  • Size
  • Source code size: 15.92 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 524.75 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • skycloudd/assert_size
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • skycloudd

assert_size

Rust

A macro to assert that a type has a specific size at compile time

Usage

use assert_size::assert_size;

assert_size!((), 0);
assert_size!(u8, 1);
assert_size!(u16, 2);

struct Foo {
    a: u8, // 1 byte
    // 1 byte padding
    b: u16, // 2 bytes
}

assert_size!(Foo, 4);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.