const_fn

A lightweight attribute for easy generation of const functions with conditional compilations.

APACHE-2.0 License

Downloads
33.4M
Stars
26
Committers
1

Bot releases are visible (Hide)

const_fn - 0.4.10 Latest Release

Published by github-actions[bot] 6 months ago

  • Respect RUSTC_WRAPPER in rustc version detection.
const_fn - 0.4.9

Published by github-actions[bot] almost 3 years ago

const_fn - 0.4.8

Published by github-actions[bot] over 3 years ago

const_fn - 0.4.7

Published by github-actions[bot] over 3 years ago

const_fn - 0.4.6

Published by github-actions[bot] over 3 years ago

  • Fix compatibility issues with const generics.
const_fn - 0.4.5

Published by github-actions[bot] almost 4 years ago

  • Exclude unneeded files from crates.io.
const_fn - 0.4.4

Published by github-actions[bot] almost 4 years ago

const_fn - 0.4.1

Published by taiki-e about 4 years ago

const_fn - 0.4.0

Published by taiki-e about 4 years ago

  • Add support for version-based code generation. The following conditions are available:

    use const_fn::const_fn;
    
    // function is `const` on specified version and later compiler (including beta and nightly)
    #[const_fn("1.36")]
    pub const fn version() {
        /* ... */
    }
    
    // function is `const` on nightly compiler (including dev build)
    #[const_fn(nightly)]
    pub const fn nightly() {
        /* ... */
    }
    
    // function is `const` if `cfg(...)` is true
    #[const_fn(cfg(...))]
    pub const fn cfg() {
        /* ... */
    }
    
    // function is `const` if `cfg(feature = "...")` is true
    #[const_fn(feature = "...")]
    pub const fn feature() {
        /* ... */
    }
    
  • Improve compile time by removing proc-macro related dependencies (#18, #20).

Package Rankings
Top 8.34% on Crates.io
Badges
Extracted from project README
crates.io docs.rs license msrv github actions