assert_size

Crates.ioassert_size
lib.rsassert_size
version0.1.1
sourcesrc
created_at2024-04-19 13:56:45.30714
updated_at2024-04-19 14:23:06.728822
descriptionA macro to assert that a type has a specific size at compile time
homepage
repositoryhttps://github.com/skycloudd/assert_size
max_upload_size
id1213707
size16,272
(skycloudd)

documentation

README

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.

Commit count: 10

cargo fmt