MCPcopy Create free account
hub / github.com/ElementsProject/elements / read

Method read

src/streams.h:165–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163 bool empty() const { return m_data.empty(); }
164
165 void read(Span<std::byte> dst)
166 {
167 if (dst.size() == 0) {
168 return;
169 }
170
171 // Read from the beginning of the buffer
172 if (dst.size() > m_data.size()) {
173 throw std::ios_base::failure("SpanReader::read(): end of data");
174 }
175 memcpy(dst.data(), m_data.data(), dst.size());
176 m_data = m_data.subspan(dst.size());
177 }
178};
179
180/** Double ended buffer combining vector and stream-like interfaces.

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected