Crates.io | assert_size |
lib.rs | assert_size |
version | 0.1.1 |
source | src |
created_at | 2024-04-19 13:56:45.30714 |
updated_at | 2024-04-19 14:23:06.728822 |
description | A macro to assert that a type has a specific size at compile time |
homepage | |
repository | https://github.com/skycloudd/assert_size |
max_upload_size | |
id | 1213707 |
size | 16,272 |
A macro to assert that a type has a specific size at compile time
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);
Licensed under either of
at your option.
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.