I'm writing a parser and would like to have an error type containing filename + line where a parser failed. I believe right now my only options are:
defmt::error!() at the place where parsing fails (but that might not be a real error because I'd want to try multiple parsers)
- Use core
Location::caller() or file!() which embed &str into the binary
So a file!() macro returning an interned Str containing the filename would cover my use case, analogous to std::file!(). A module_path!() would be cool too but I'm not sure if there's a way to do that.
I'm writing a parser and would like to have an error type containing filename + line where a parser failed. I believe right now my only options are:
defmt::error!()at the place where parsing fails (but that might not be a real error because I'd want to try multiple parsers)Location::caller()orfile!()which embed&strinto the binarySo a
file!()macro returning an internedStrcontaining the filename would cover my use case, analogous tostd::file!(). Amodule_path!()would be cool too but I'm not sure if there's a way to do that.