Skip to content

Add defmt::file!() #1030

@darkwater

Description

@darkwater

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions