Back to Site
Loading...
Searching...
No Matches
bytes.h File Reference

Lightweight byte container aliases and a non-owning byte view. More...

#include <cstdint>
#include <cstddef>
#include <vector>
#include <string>
Include dependency graph for bytes.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  librats::ByteView
 Non-owning view over a contiguous run of bytes. More...
 
class  librats::ByteSpan
 Non-owning view over a contiguous run of writable bytes. More...
 

Namespaces

namespace  librats
 

Typedefs

using librats::Bytes = std::vector< uint8_t >
 

Detailed Description

Lightweight byte container aliases and a non-owning byte view.

ByteView is a C++17 stand-in for std::span<const uint8_t>: a cheap (pointer, length) pair used to pass payloads around without copying. It does NOT own its storage — the referenced bytes must outlive the view. On the receive path views point straight into the connection's ReceiveBuffer and are only valid until the buffer is consumed.

ByteSpan is the mutable counterpart (std::span<uint8_t>), handed out by ReceiveBuffer::prepare() as the destination of a recv().

Definition in file bytes.h.