1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:37:44 +00:00

AK: Format the contents of NNRP<T> if T is formattable

This commit is contained in:
Ali Mohammad Pur 2022-12-10 19:33:37 +03:30 committed by Ali Mohammad Pur
parent ff038f306a
commit 08fc42002c
2 changed files with 12 additions and 0 deletions

View file

@ -228,7 +228,16 @@ inline NonnullRefPtr<T> adopt_ref(T& object)
return NonnullRefPtr<T>(NonnullRefPtr<T>::Adopt, object);
}
template<Formattable T>
struct Formatter<NonnullRefPtr<T>> : Formatter<T> {
ErrorOr<void> format(FormatBuilder& builder, NonnullRefPtr<T> const& value)
{
return Formatter<T>::format(builder, *value);
}
};
template<typename T>
requires(!HasFormatter<T>)
struct Formatter<NonnullRefPtr<T>> : Formatter<T const*> {
ErrorOr<void> format(FormatBuilder& builder, NonnullRefPtr<T> const& value)
{