Print file, function and line number for debugging

Is there anything like

std::cerr << __FUNCTION__;

in rust where i could print file, function and line number etc. Would be very helpful indeed.

there are a few macros: line!, column! and file!

You can find a bunch of other useful macros in the standard library documentation (look at the bottom of the page)


Ah wonderful thank you

oh no there is nothing for function name though - or did i miss it. That would be the most crucial one for me.

I think they reasoned that filename, line and column would be enough for debugging.

1 Like