pub struct SizeSink { /* private fields */ }Expand description
A byte-counting write sink that measures a proof’s serialized size without materializing it:
it keeps only a running length, discarding every chunk the moment its bytes are counted, and once
the total would exceed cap it refuses further writes (returning core::fmt::Error, which the
streaming emitters map to EmitError::SizeCapExceeded). This lets us report our own proof size
on the benchmarks page in O(1) memory, and guarantees a pathological (super-linear) proof aborts
early rather than exhausting RAM — the streaming, capped counterpart to emit_*(...).len().
Implementations§
Source§impl SizeSink
impl SizeSink
Sourcepub fn new(cap: u64) -> Self
pub fn new(cap: u64) -> Self
A sink that counts up to cap bytes before it starts refusing writes.
Sourcepub fn bytes(&self) -> u64
pub fn bytes(&self) -> u64
Bytes streamed through so far (the serialized proof size when emission ran to completion).
Sourcepub fn overflowed(&self) -> bool
pub fn overflowed(&self) -> bool
Whether the cap was hit — the measured proof is at least cap bytes, exact size unknown.