#static #assert #static-assert

static_assert_macro

Library implementation of so-called static_assert

6 stable releases

Uses old Rust 2015

1.1.0 Dec 13, 2020
1.0.4 Jun 14, 2020
1.0.3 Apr 7, 2019
1.0.2 Jun 17, 2017
1.0.0 Apr 16, 2016

#2029 in Rust patterns

Download history 497/week @ 2023-11-27 537/week @ 2023-12-04 569/week @ 2023-12-11 562/week @ 2023-12-18 165/week @ 2023-12-25 511/week @ 2024-01-01 731/week @ 2024-01-08 513/week @ 2024-01-15 732/week @ 2024-01-22 682/week @ 2024-01-29 710/week @ 2024-02-05 807/week @ 2024-02-12 764/week @ 2024-02-19 705/week @ 2024-02-26 653/week @ 2024-03-04 303/week @ 2024-03-11

2,433 downloads per month

Apache-2.0

7KB

Continuous integration Crates.io docs.rs license 

static_assert macro

Cargo.toml:

[dependencies]
static_assert_macro = "1"

Your code (Rust 2018):

use static_assert_macro::static_assert;

static_assert!(1 < 2);

fn main() {
    static_assert!(3 < 4);
    static_assert!(10 < 10); // build failure
}

For Rust 2015, replace use static_assert_macro::static_assert; with

#[macro_use]
extern crate static_assert_macro;

For more details, visit

Minimum Supported Rust Version

  • static_assert_macro < 1.1: sufficiently old Rust such as 1.8 (2016-04-14)
  • static_assert_macro >= 1.1: Rust 1.37 (2019-08-15) which stabilized underscore_const_names

License

This crate is a free software distributed under the Apache 2.0 license.

No runtime deps