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

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 :^)
This commit is contained in:
Ali Mohammad Pur 2023-03-28 11:04:46 +03:30 committed by Linus Groh
parent 4a82f9bd03
commit a28aba7663

View File

@ -95,6 +95,7 @@ public:
DeprecatedString(DeprecatedFlyString const&);
static ErrorOr<DeprecatedString> from_utf8(ReadonlyBytes);
static ErrorOr<DeprecatedString> 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);