StormByte 2.0.0
C++26 foundation of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Detail::Codec< Safe::String > Struct Reference

UTF-8 text codec with the same wire layout as std::string. More...

#include <StormByte/serializable.hxx>

Static Public Member Functions

static ByteSize Size (const Safe::String &data) noexcept
 Serialized size of data.
 
static BinaryData Write (const Safe::String &data) noexcept
 Encodes data.
 
static Expected< Safe::String, DeserializeError > Read (std::span< const std::byte > data) noexcept
 Decodes text.
 

Detailed Description

UTF-8 text codec with the same wire layout as std::string.

Member Function Documentation

◆ Read()

static Expected< Safe::String, DeserializeError > StormByte::Detail::Codec< Safe::String >::Read ( std::span< const std::byte >  data)
staticnoexcept

Decodes text.

Parameters
dataInput bytes.
Returns
Text or error.

◆ Size()

static ByteSize StormByte::Detail::Codec< Safe::String >::Size ( const Safe::String &  data)
staticnoexcept

Serialized size of data.

Parameters
dataText to measure.
Returns
Size in bytes.

◆ Write()

static BinaryData StormByte::Detail::Codec< Safe::String >::Write ( const Safe::String &  data)
staticnoexcept

Encodes data.

Parameters
dataText to encode.
Returns
Owned blob.

The documentation for this struct was generated from the following file: