MCPcopy Create free account
hub / github.com/base/base / encode

Method encode

crates/consensus/protocol/src/batch/core.rs:66–78  ·  view source on GitHub ↗

Attempts to encode the batch to a writer.

(&self, out: &mut dyn bytes::BufMut)

Source from the content-addressed store, hash-verified

64
65 /// Attempts to encode the batch to a writer.
66 pub fn encode(&self, out: &mut dyn bytes::BufMut) -> Result<(), BatchEncodingError> {
67 match self {
68 Self::Single(sb) => {
69 out.put_u8(BatchType::Single as u8);
70 sb.encode(out);
71 }
72 Self::Span(sb) => {
73 out.put_u8(BatchType::Span as u8);
74 sb.encode(out).map_err(BatchEncodingError::SpanBatchError)?;
75 }
76 }
77 Ok(())
78 }
79}
80
81#[cfg(test)]

Callers 3

test_empty_span_batchFunction · 0.45

Calls

no outgoing calls

Tested by 3

test_empty_span_batchFunction · 0.36