Crates.io | qed |
lib.rs | qed |
version | 1.6.1 |
source | src |
created_at | 2022-04-08 05:12:25.867865 |
updated_at | 2023-06-02 17:52:02.423353 |
description | Compile-time assertions |
homepage | https://github.com/artichoke/qed |
repository | https://github.com/artichoke/qed |
max_upload_size | |
id | 564037 |
size | 24,441 |
Compile time assertions.
QED is an initialism of the Latin phrase quod erat demonstrandum, meaning "which was to be demonstrated".
This crate contains compile time assertion macros used for maintaining safety invariants or limiting platform support. If the assertion is false, a compiler error is emitted.
Add this to your Cargo.toml
:
[dependencies]
qed = "1.6.1"
Then make compile time assertions like:
use core::num::NonZeroU8;
qed::const_assert!(usize::BITS >= u32::BITS);
qed::const_assert_eq!("Veni, vidi, vici".len(), 16);
qed::const_assert_ne!('∎'.len_utf8(), 1);
qed::const_assert_matches!(NonZeroU8::new(42), Some(nz) if nz.get() == 42);
no_std
qed is no_std
compatible and all macros only require core
.
This crate requires at least Rust 1.64.0. This version can be bumped in minor releases.
qed
is licensed under the MIT License (c) Ryan Lopopolo.