Files
Language-Server/include/vls/Framing.hpp
T
faumaray ca04975d54 bootstrap
Signed-off-by: faumaray <faumaray@gmail.com>
2026-11-25 02:11:19 +03:00

26 lines
720 B
C++

#pragma once
#include <cstddef>
#include <expected>
#include <iosfwd>
#include <optional>
#include <string>
#include <string_view>
namespace vls {
struct FrameLimits {
std::size_t header_bytes{8192};
std::size_t body_bytes{16777216};
};
// A disengaged optional means EOF between frames. Framing errors are fatal: the
// caller must not attempt to find another frame in an untrusted byte stream.
[[nodiscard]] std::expected<std::optional<std::string>, std::string>
read_frame(std::istream &input, FrameLimits limits = {});
[[nodiscard]] std::expected<void, std::string> write_frame(std::ostream &output,
std::string_view body);
} // namespace vls