macro
column! — Identify the source column number
Yield a one-based u32 source column associated with the invocation. The location depends on the source and macro expansion context; it is not a byte offset for indexing a runtime string. Expression result: u32. Expected result (not executed): stdout: 'Positive column: true\n'; no stderr. Common mistake: Using the reported source column as an index into user input.
Formal Syntax & Structure
rust syntaxrust
column!()Working Example
Example Snippetrust
fn main() { let c = column!(); println!("Positive column: {}", c > 0);}