Commit a9b26be1 authored by Dominik Charousset's avatar Dominik Charousset

Allow asigning new input to binary deserializers

parent 5ebeb85c
......@@ -91,6 +91,9 @@ public:
/// @pre `num_bytes <= remaining()`
void skip(size_t num_bytes);
/// Assings a new input.
void reset(span<const byte> bytes);
protected:
error apply_impl(int8_t&) override;
......
......@@ -128,6 +128,11 @@ void binary_deserializer::skip(size_t num_bytes) {
current_ += num_bytes;
}
void binary_deserializer::reset(span<const byte> bytes) {
current_ = bytes.data();
end_ = current_ + bytes.size();
}
error binary_deserializer::apply_impl(int8_t& x) {
return apply_raw(sizeof(int8_t), &x);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment