lib: improve printability for some types
A little fmt pixie dust
This commit is contained in:
@ -207,7 +207,10 @@ struct Field {
|
||||
}
|
||||
};
|
||||
|
||||
static inline bool operator==(const Field& f1, const Field& f2) { return f1.id == f2.id; }
|
||||
// equality
|
||||
static inline constexpr bool operator==(const Field& f1, const Field& f2) { return f1.id == f2.id; }
|
||||
static inline constexpr bool operator==(const Field& f1, const Field::Id id) { return f1.id == id; }
|
||||
|
||||
|
||||
MU_ENABLE_BITOPS(Field::Flag);
|
||||
|
||||
@ -594,20 +597,5 @@ 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__ */
|
||||
|
||||
Reference in New Issue
Block a user