Function proc_macro::is_available
1.57.0 · source · pub fn is_available() -> bool
Expand description
Determines whether proc_macro has been made accessible to the currently running program.
The proc_macro crate is only intended for use inside the implementation of procedural macros. All the functions in this crate panic if invoked from outside of a procedural macro, such as from a build script or unit test or ordinary Rust binary.
With consideration for Rust libraries that are designed to support both
macro and non-macro use cases, proc_macro::is_available()
provides a
non-panicking way to detect whether the infrastructure required to use the
API of proc_macro is presently available. Returns true if invoked from
inside of a procedural macro, false if invoked from any other binary.