AK: Add formatter for URL.
This commit is contained in:
parent
aa283d235a
commit
b23f66e151
Notes:
sideshowbarker
2024-07-19 02:04:43 +09:00
Author: https://github.com/asynts Commit: https://github.com/SerenityOS/serenity/commit/b23f66e1516 Pull-request: https://github.com/SerenityOS/serenity/pull/3679
1 changed files with 8 additions and 0 deletions
8
AK/URL.h
8
AK/URL.h
|
@ -102,6 +102,14 @@ inline const LogStream& operator<<(const LogStream& stream, const URL& value)
|
|||
return stream << value.to_string();
|
||||
}
|
||||
|
||||
template<>
|
||||
struct Formatter<URL> : Formatter<StringView> {
|
||||
void format(TypeErasedFormatParams& params, FormatBuilder& builder, const URL& value)
|
||||
{
|
||||
Formatter<StringView>::format(params, builder, value.to_string());
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct Traits<URL> : public GenericTraits<URL> {
|
||||
static unsigned hash(const URL& url) { return url.to_string().hash(); }
|
||||
|
|
Loading…
Add table
Reference in a new issue