Crate static_assertions [] [src]

Compile-time assertions to ensure that invariants are met.

Usage

This crate is available on crates.io and can be used by adding the following to your project's Cargo.toml:

[dependencies]
static_assertions = "0.2.4"

and this to your crate root:

#[macro_use]
extern crate static_assertions;

Limitations

Due to implementation details, some macros can only be used normally from within the context of a function. To use these macros in other contexts, a unique label must be provided.

This issue can be followed here. Feedback and potential solutions are welcome!

Macros

assert_cfg

Asserts that the configuration is set.

assert_eq_size

Asserts at compile-time that the types have equal sizes.

assert_eq_size_ptr

Asserts at compile-time that the values pointed to have equal sizes.

assert_eq_size_val

Asserts at compile-time that the values have equal sizes.

assert_fields

Asserts at compile-time that the type has the given fields.

assert_impl

Asserts at compile-time that the type implements the given traits.

assert_obj_safe

Asserts at compile-time that the traits are object-safe.

const_assert

Asserts at compile-time that the constant expression evaluates to true.

const_assert_eq

Asserts at compile-time that the constants are equal in value.