From a28aba76639cb8ae9d5312f98550308248a1a4f6 Mon Sep 17 00:00:00 2001 From: Ali Mohammad Pur Date: Tue, 28 Mar 2023 11:04:46 +0330 Subject: [PATCH] AK: Add DeprecatedString::from_utf8(StringView) This mirrors String::from_utf8(StringView). Jakt will use this to construct strings instead of just assuming the allocation will succeed, lowering the API difference between Jakt::String and AK::String by one API :^) --- AK/DeprecatedString.h | 1 + 1 file changed, 1 insertion(+) diff --git a/AK/DeprecatedString.h b/AK/DeprecatedString.h index 21952cd4b2..72cecc95a4 100644 --- a/AK/DeprecatedString.h +++ b/AK/DeprecatedString.h @@ -95,6 +95,7 @@ public: DeprecatedString(DeprecatedFlyString const&); static ErrorOr from_utf8(ReadonlyBytes); + static ErrorOr from_utf8(StringView string) { return from_utf8(string.bytes()); } [[nodiscard]] static DeprecatedString repeated(char, size_t count); [[nodiscard]] static DeprecatedString repeated(StringView, size_t count);