MCPcopy Create free account
hub / github.com/SeismicSystems/summit / write

Method write

types/src/block.rs:252–258  ·  view source on GitHub ↗
(&self, buf: &mut impl BufMut)

Source from the content-addressed store, hash-verified

250
251 fn read_cfg(buf: &mut impl Buf, _cfg: &Self::Cfg) -> Result<Self, Error> {
252 let len = buf.try_get_u32().map_err(|_| Error::EndOfBuffer)? as usize;
253 if len > buf.remaining() {
254 return Err(Error::Invalid("Block", "improper encoded length"));
255 }
256
257 // Decode SSZ directly from the buffer's contiguous chunk to avoid
258 // copying the (up to message-size) payload into a temporary Vec first.
259 // `chunk()` returns the whole remaining slice for the contiguous buffers
260 // used on the decode paths (`&[u8]`/`Bytes`); for a non-contiguous
261 // buffer it may be shorter than `len`, in which case we fall back to a

Calls 2

lenMethod · 0.80
putMethod · 0.80