mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-06 01:26:22 +00:00
AK: Define our own concept of "trivially serializable"
While at it, rename the `read_trivial_value` and `write_trivial_value` functions to `read_value` and `write_value` respectively, since we'll add compatibility for non-trivial types down the line.
This commit is contained in:
parent
6777cb0975
commit
d1711f1cef
Notes:
sideshowbarker
2024-07-17 01:38:22 +09:00
Author: https://github.com/timschumi
Commit: d1711f1cef
Pull-request: https://github.com/SerenityOS/serenity/pull/17029
Reviewed-by: https://github.com/trflynn89 ✅
5 changed files with 23 additions and 14 deletions
|
@ -79,10 +79,10 @@ ErrorOr<void> Name::write_to_stream(Core::Stream::Stream& stream) const
|
|||
{
|
||||
auto parts = as_string().split_view('.');
|
||||
for (auto& part : parts) {
|
||||
TRY(stream.write_trivial_value<u8>(part.length()));
|
||||
TRY(stream.write_value<u8>(part.length()));
|
||||
TRY(stream.write_entire_buffer(part.bytes()));
|
||||
}
|
||||
TRY(stream.write_trivial_value('\0'));
|
||||
TRY(stream.write_value('\0'));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue