[![Banner](https://raw.githubusercontent.com/nvzqz/static-assertions-rs/assets/Banner.png)](https://github.com/nvzqz/static-assertions-rs)
Crates.io Downloads Build Status rustc ^1.24.0
Become a Patron! Buy me a coffee
Rust compile-time assertions to ensure that invariants are met. [Documentation](https://docs.rs/static_assertions/) ## Installation This crate is available [on crates.io](https://crates.io/crates/static_assertions) and can be used by adding the following to your project's [`Cargo.toml`](https://doc.rust-lang.org/cargo/reference/manifest.html): ```toml [dependencies] static_assertions = "0.3.4" ``` and this to your crate root (`main.rs` or `lib.rs`): ```rust #[macro_use] extern crate static_assertions; ``` ## Usage This crate exposes the following macros: - [`assert_cfg!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_cfg.html) - [`assert_eq_size!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_eq_size.html) - [`assert_eq_size_ptr!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_eq_size_ptr.html) - [`assert_eq_size_val!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_eq_size_val.html) - [`assert_eq_type!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_eq_type.html) - [`assert_ne_type!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_ne_type.html) - [`assert_fields!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_fields.html) - [`assert_impl_all!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_impl_all.html) - [`assert_obj_safe!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.assert_obj_safe.html) - [`const_assert!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.const_assert.html) - [`const_assert_eq!`](https://docs.rs/static_assertions/0.3.4/static_assertions/macro.const_assert_eq.html) ### Limitations See [issue #1](https://github.com/nvzqz/static-assertions-rs/issues/1) to read up on current limitations of this crate and how to currently overcome them. ## Changes See [`CHANGELOG.md`](https://github.com/nvzqz/static-assertions-rs/blob/master/CHANGELOG.md) for a complete list of what has changed from one version to another. ## License This project is released under either: - [MIT License](https://github.com/nvzqz/static-assertions-rs/blob/master/LICENSE-MIT) - [Apache License (Version 2.0)](https://github.com/nvzqz/static-assertions-rs/blob/master/LICENSE-APACHE) at your choosing.