1
0
mirror of https://github.com/SerenityOS/serenity synced 2024-07-09 10:37:24 +00:00

AK: Don't inherit Formatter<ErrorOr<T>> for Formatter<IPv4Address>

This commit is contained in:
MacDue 2023-01-13 02:21:33 +00:00 committed by Linus Groh
parent 2150e1b3a5
commit d5152c49a1

View File

@ -158,18 +158,18 @@ struct Traits<IPv4Address> : public GenericTraits<IPv4Address> {
#ifdef KERNEL
template<>
struct Formatter<IPv4Address> : Formatter<ErrorOr<NonnullOwnPtr<Kernel::KString>>> {
struct Formatter<IPv4Address> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, IPv4Address value)
{
return Formatter<ErrorOr<NonnullOwnPtr<Kernel::KString>>>::format(builder, TRY(value.to_string()));
return Formatter<StringView>::format(builder, TRY(value.to_string())->view());
}
};
#else
template<>
struct Formatter<IPv4Address> : Formatter<DeprecatedString> {
struct Formatter<IPv4Address> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, IPv4Address value)
{
return Formatter<DeprecatedString>::format(builder, value.to_deprecated_string());
return Formatter<StringView>::format(builder, value.to_deprecated_string());
}
};
#endif