StormByte-String 1.0.0
C++26 string module of the StormByte suite
 
Loading...
Searching...
No Matches
StormByte::Detail::Codec< String::String > Struct Reference

StormByte::Detail::Codec specialization for StormByte::String::String. More...

#include <StormByte/string/serializable.hxx>

Static Public Member Functions

static std::size_t Size (const String::String &data) noexcept
 Serialized size of data.
 
static std::vector< std::byte > Write (const String::String &data) noexcept
 Encodes data.
 
static Expected< String::String, DeserializeError > Read (std::span< const std::byte > data) noexcept
 Decodes a StormByte::String::String from the start of data.
 

Detailed Description

StormByte::Detail::Codec specialization for StormByte::String::String.

Same wire as std::string: uint64 byte count (LE) + raw UTF-8 bytes. A null StormByte::String::String is written as an empty payload. Decode always yields a non-null buffer ("" when the payload is empty).

Member Function Documentation

◆ Read()

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

Decodes a StormByte::String::String from the start of data.

Parameters
dataInput span.
Returns
Value, or StormByte::DeserializeError.

◆ Size()

static std::size_t StormByte::Detail::Codec< String::String >::Size ( const String::String &  data)
staticnoexcept

Serialized size of data.

Parameters
dataValue to measure.
Returns
Size in bytes.

◆ Write()

static std::vector< std::byte > StormByte::Detail::Codec< String::String >::Write ( const String::String &  data)
staticnoexcept

Encodes data.

Parameters
dataValue to encode.
Returns
Blob.

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