Skip to main content

Symbol

Macro Symbol 

Source
macro_rules! Symbol {
    ($ident:ident) => { ... };
}
Expand description

Creates a Symbol reference capturing the current source location for the given identifier.

This macro is primarily used internally by init_static! to record metadata about each declared static variable. It captures compile-time information using the standard location macros (file!, line!, column! and module_path!).

§Example

use init_static::{Symbol};

let symbol: &Symbol = Symbol!(MY_VALUE);
assert_eq!(symbol.ident, "MY_VALUE");
assert!(symbol.file.ends_with(".rs"));

§Note

This macro returns a &'static Symbol reference, which is suitable for use in static contexts and error reporting.