LibGC: Make GC::Root formattable

This commit is contained in:
Sam Atkins 2025-04-24 15:43:12 +01:00
commit 6d2f393f2b
Notes: github-actions[bot] 2025-05-01 16:17:06 +00:00

View file

@ -170,6 +170,14 @@ struct Traits<GC::Root<T>> : public DefaultTraits<GC::Root<T>> {
static unsigned hash(GC::Root<T> const& handle) { return Traits<T>::hash(handle); }
};
template<typename T>
struct Formatter<GC::Root<T>> : Formatter<T const*> {
ErrorOr<void> format(FormatBuilder& builder, GC::Root<T> const& value)
{
return Formatter<T const*>::format(builder, value.ptr());
}
};
namespace Detail {
template<typename T>
inline constexpr bool IsHashCompatible<GC::Root<T>, T> = true;