AK: Return a constant reference from JsonValue::as_string

Rather than making a copy of the held string, this returns a reference
so that expressions like the following:

    do_something(json.as_string().view());

are not disallowed once `ByteString::view() &&` is deleted.
This commit is contained in:
Timothy Flynn 2024-04-03 21:28:20 -04:00 committed by Andreas Kling
parent 6d38d55fc8
commit c7ea710b55

View file

@ -128,7 +128,7 @@ public:
return m_value.get<bool>(); return m_value.get<bool>();
} }
ByteString as_string() const ByteString const& as_string() const
{ {
return m_value.get<ByteString>(); return m_value.get<ByteString>();
} }