mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +00:00
AK: Introduce a fallible version of StringBuilder::to_byte_buffer
Name it StringBuilder::try_to_byte_buffer accordingly :^)
This commit is contained in:
parent
8b8e91d4da
commit
b4b283670d
2 changed files with 6 additions and 0 deletions
|
@ -111,6 +111,11 @@ ByteBuffer StringBuilder::to_byte_buffer() const
|
||||||
return ByteBuffer::copy(data(), length()).release_value_but_fixme_should_propagate_errors();
|
return ByteBuffer::copy(data(), length()).release_value_but_fixme_should_propagate_errors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ErrorOr<ByteBuffer> StringBuilder::try_to_byte_buffer() const
|
||||||
|
{
|
||||||
|
return TRY(ByteBuffer::copy(data(), length()));
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef KERNEL
|
#ifndef KERNEL
|
||||||
DeprecatedString StringBuilder::to_deprecated_string() const
|
DeprecatedString StringBuilder::to_deprecated_string() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,7 @@ public:
|
||||||
ErrorOr<FlyString> to_fly_string() const;
|
ErrorOr<FlyString> to_fly_string() const;
|
||||||
|
|
||||||
[[nodiscard]] ByteBuffer to_byte_buffer() const;
|
[[nodiscard]] ByteBuffer to_byte_buffer() const;
|
||||||
|
[[nodiscard]] ErrorOr<ByteBuffer> try_to_byte_buffer() const;
|
||||||
|
|
||||||
[[nodiscard]] StringView string_view() const;
|
[[nodiscard]] StringView string_view() const;
|
||||||
void clear();
|
void clear();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue