message & friends: make formattable

So we can easily debug-print them.
This commit is contained in:
Dirk-Jan C. Binnema
2023-08-09 20:06:03 +03:00
parent 4dcd457b7f
commit 04219b55f7
4 changed files with 38 additions and 9 deletions

View File

@ -594,5 +594,20 @@ Option<Field> field_from_number(size_t id)
}
/**
* Get a fmt-printable representation of Field for fmt
*
* @param field a Field
*
* @return a printable representation
*/
static inline constexpr auto format_as(const Field& field) {
return field.name;
}
static inline constexpr auto format_as(const Field::Id id) {
return format_as(field_from_id(id));
}
} // namespace Mu
#endif /* MU_FIELDS_HH__ */