You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 13, 2026. It is now read-only.
I have a situation where at deserialization time I'd like a view-only object like std::span (which I would give to another object's constructor where the data will be copied out). I'd like to implement my own nop::Encoding<std::span<uint8_t>> specialization for that. Unfortunately, it cannot be done on that level of abstractions since I would need to access, say, buffer_[index_] of BufferReader (https://github.com/google/libnop/blob/master/include/nop/utility/buffer_reader.h#L80).
I can instead read the prefix_byte and length at the place where I would ideally just call deserializer.Read(&myspan), get the offset via deserializer.reader().capacity() - deserializer.reader().remaining(), call deserializer.reader().Skip(length_bytes) and use the offset to index into my buffer. However, it would be nicer to encapsulate this logic.
One option would be to add a Status<void*> Ptr() { return buffer_[index_]; } method to BufferReader, and perhaps similar methods returning a failure status for other readers.
I have a situation where at deserialization time I'd like a view-only object like std::span (which I would give to another object's constructor where the data will be copied out). I'd like to implement my own
nop::Encoding<std::span<uint8_t>>specialization for that. Unfortunately, it cannot be done on that level of abstractions since I would need to access, say,buffer_[index_]ofBufferReader(https://github.com/google/libnop/blob/master/include/nop/utility/buffer_reader.h#L80).I can instead read the prefix_byte and length at the place where I would ideally just call
deserializer.Read(&myspan), get the offset viadeserializer.reader().capacity() - deserializer.reader().remaining(), calldeserializer.reader().Skip(length_bytes)and use the offset to index into my buffer. However, it would be nicer to encapsulate this logic.One option would be to add a
Status<void*> Ptr() { return buffer_[index_]; }method toBufferReader, and perhaps similar methods returning a failure status for other readers.