1bcab3026Sopenharmony_ci//! [](https://github.com/nvzqz/static-assertions-rs) 2bcab3026Sopenharmony_ci//! 3bcab3026Sopenharmony_ci//! <div align="center"> 4bcab3026Sopenharmony_ci//! <a href="https://crates.io/crates/static_assertions"> 5bcab3026Sopenharmony_ci//! <img src="https://img.shields.io/crates/d/static_assertions.svg" alt="Downloads"> 6bcab3026Sopenharmony_ci//! </a> 7bcab3026Sopenharmony_ci//! <a href="https://travis-ci.org/nvzqz/static-assertions-rs"> 8bcab3026Sopenharmony_ci//! <img src="https://travis-ci.org/nvzqz/static-assertions-rs.svg?branch=master" alt="Build Status"> 9bcab3026Sopenharmony_ci//! </a> 10bcab3026Sopenharmony_ci//! <img src="https://img.shields.io/badge/rustc-^1.37.0-blue.svg" alt="rustc ^1.37.0"> 11bcab3026Sopenharmony_ci//! <br><br> 12bcab3026Sopenharmony_ci//! </div> 13bcab3026Sopenharmony_ci//! 14bcab3026Sopenharmony_ci//! Assertions to ensure correct assumptions about constants, types, and more. 15bcab3026Sopenharmony_ci//! 16bcab3026Sopenharmony_ci//! _All_ checks provided by this crate are performed at [compile-time]. This 17bcab3026Sopenharmony_ci//! allows for finding errors quickly and early when it comes to ensuring 18bcab3026Sopenharmony_ci//! certain features or aspects of a codebase. These macros are especially 19bcab3026Sopenharmony_ci//! important when exposing a public API that requires types to be the same size 20bcab3026Sopenharmony_ci//! or implement certain traits. 21bcab3026Sopenharmony_ci//! 22bcab3026Sopenharmony_ci//! # Usage 23bcab3026Sopenharmony_ci//! 24bcab3026Sopenharmony_ci//! This crate is available [on crates.io][crate] and can be used by adding the 25bcab3026Sopenharmony_ci//! following to your project's [`Cargo.toml`]: 26bcab3026Sopenharmony_ci//! 27bcab3026Sopenharmony_ci//! ```toml 28bcab3026Sopenharmony_ci//! [dependencies] 29bcab3026Sopenharmony_ci//! static_assertions = "1.1.0" 30bcab3026Sopenharmony_ci//! ``` 31bcab3026Sopenharmony_ci//! 32bcab3026Sopenharmony_ci//! and this to your crate root (`main.rs` or `lib.rs`): 33bcab3026Sopenharmony_ci//! 34bcab3026Sopenharmony_ci//! ``` 35bcab3026Sopenharmony_ci//! #[macro_use] 36bcab3026Sopenharmony_ci//! extern crate static_assertions; 37bcab3026Sopenharmony_ci//! # fn main() {} 38bcab3026Sopenharmony_ci//! ``` 39bcab3026Sopenharmony_ci//! 40bcab3026Sopenharmony_ci//! When using [Rust 2018 edition][2018], the following shorthand can help if 41bcab3026Sopenharmony_ci//! having `#[macro_use]` is undesirable. 42bcab3026Sopenharmony_ci//! 43bcab3026Sopenharmony_ci//! ```edition2018 44bcab3026Sopenharmony_ci//! extern crate static_assertions as sa; 45bcab3026Sopenharmony_ci//! 46bcab3026Sopenharmony_ci//! sa::const_assert!(true); 47bcab3026Sopenharmony_ci//! ``` 48bcab3026Sopenharmony_ci//! 49bcab3026Sopenharmony_ci//! # Examples 50bcab3026Sopenharmony_ci//! 51bcab3026Sopenharmony_ci//! Very thorough examples are provided in the docs for 52bcab3026Sopenharmony_ci//! [each individual macro](#macros). Failure case examples are also documented. 53bcab3026Sopenharmony_ci//! 54bcab3026Sopenharmony_ci//! # Changes 55bcab3026Sopenharmony_ci//! 56bcab3026Sopenharmony_ci//! See [`CHANGELOG.md`](https://github.com/nvzqz/static-assertions-rs/blob/master/CHANGELOG.md) 57bcab3026Sopenharmony_ci//! for an exhaustive list of what has changed from one version to another. 58bcab3026Sopenharmony_ci//! 59bcab3026Sopenharmony_ci//! # Donate 60bcab3026Sopenharmony_ci//! 61bcab3026Sopenharmony_ci//! This project is made freely available (as in free beer), but unfortunately 62bcab3026Sopenharmony_ci//! not all beer is free! So, if you would like to buy me a beer (or coffee or 63bcab3026Sopenharmony_ci//! *more*), then consider supporting my work that's benefited your project 64bcab3026Sopenharmony_ci//! and thousands of others. 65bcab3026Sopenharmony_ci//! 66bcab3026Sopenharmony_ci//! <a href="https://www.patreon.com/nvzqz"> 67bcab3026Sopenharmony_ci//! <img src="https://c5.patreon.com/external/logo/become_a_patron_button.png" alt="Become a Patron!" height="35"> 68bcab3026Sopenharmony_ci//! </a> 69bcab3026Sopenharmony_ci//! <a href="https://www.paypal.me/nvzqz"> 70bcab3026Sopenharmony_ci//! <img src="https://buymecoffee.intm.org/img/button-paypal-white.png" alt="Buy me a coffee" height="35"> 71bcab3026Sopenharmony_ci//! </a> 72bcab3026Sopenharmony_ci//! 73bcab3026Sopenharmony_ci//! [Rust 1.37]: https://blog.rust-lang.org/2019/08/15/Rust-1.37.0.html 74bcab3026Sopenharmony_ci//! [2018]: https://blog.rust-lang.org/2018/12/06/Rust-1.31-and-rust-2018.html#rust-2018 75bcab3026Sopenharmony_ci//! [crate]: https://crates.io/crates/static_assertions 76bcab3026Sopenharmony_ci//! [compile-time]: https://en.wikipedia.org/wiki/Compile_time 77bcab3026Sopenharmony_ci//! [`Cargo.toml`]: https://doc.rust-lang.org/cargo/reference/manifest.html 78bcab3026Sopenharmony_ci 79bcab3026Sopenharmony_ci#![doc(html_root_url = "https://docs.rs/static_assertions/1.1.0")] 80bcab3026Sopenharmony_ci#![doc(html_logo_url = "https://raw.githubusercontent.com/nvzqz/static-assertions-rs/assets/Icon.png")] 81bcab3026Sopenharmony_ci 82bcab3026Sopenharmony_ci#![no_std] 83bcab3026Sopenharmony_ci 84bcab3026Sopenharmony_ci#![deny(unused_macros)] 85bcab3026Sopenharmony_ci 86bcab3026Sopenharmony_ci#[doc(hidden)] 87bcab3026Sopenharmony_cipub extern crate core as _core; 88bcab3026Sopenharmony_ci 89bcab3026Sopenharmony_cimod assert_cfg; 90bcab3026Sopenharmony_cimod assert_eq_align; 91bcab3026Sopenharmony_cimod assert_eq_size; 92bcab3026Sopenharmony_cimod assert_fields; 93bcab3026Sopenharmony_cimod assert_impl; 94bcab3026Sopenharmony_cimod assert_obj_safe; 95bcab3026Sopenharmony_cimod assert_trait; 96bcab3026Sopenharmony_cimod assert_type; 97bcab3026Sopenharmony_cimod const_assert; 98