mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-15 12:23:15 +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:
parent
4a82f9bd03
commit
a28aba7663
|
@ -95,6 +95,7 @@ public:
|
||||||
DeprecatedString(DeprecatedFlyString const&);
|
DeprecatedString(DeprecatedFlyString const&);
|
||||||
|
|
||||||
static ErrorOr<DeprecatedString> from_utf8(ReadonlyBytes);
|
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(char, size_t count);
|
||||||
[[nodiscard]] static DeprecatedString repeated(StringView, size_t count);
|
[[nodiscard]] static DeprecatedString repeated(StringView, size_t count);
|
||||||
|
|
Loading…
Reference in a new issue