qualifier_attr

[![Latest Version](https://img.shields.io/crates/v/qualifierattr.svg)][qualifier_attr] [![Downloads](https://img.shields.io/crates/d/qualifierattr.svg)][qualifier_attr] [![Documentation](https://docs.rs/qualifierattr/badge.svg)][qualifier_attr/docs] [![License](https://img.shields.io/crates/l/qualifierattr.svg)][qualifier_attr/license] [![Dependency Status](https://deps.rs/repo/github/JohnScience/qualifierattr/status.svg)][qualifier_attr/depstatus]

Procedural macro attributes for adding "qualifiers" to various items.

At the moment, the crate supports only functions with the following "qualifiers":

as well as structures with pub, pub(crate), etc visibility qualifiers.

Modules can't be supported due to hygiene issues.

Named fields within structs can't be supported because as far as the author understands, attribute macros can't be applied to them.

Examples

```rust use qualifierattr::fnqualifiers;

// We can add a qualifier to a function // with an attribute.

[fn_qualifiers(const)]

fn const_fn() -> u32 { 42 }

const CONSTRES: u32 = constfn();

// It's not so impresive on its own // but with cfg_attr it can be conditional.

[cfgattr(feature = "externc", nomangle, fnqualifiers(pub, extern "C"))]

fn externcfn() -> u32 { 42 } ```

Learn more about cfg_attr here.

Similar crates

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.