/// Garbage collects the provided slice and pools the rest, if any.
///
/// Returns `Err(InvalidPayload)` or `Err(WitnessPruningFailed)` if
/// `unpacked` is malformed.
Garbage collects the provided slice and pools the rest, if any.
Garbage collects the provided slice and pools the rest if any .
fn put_impl(
        &mut self,
        subnet_id: SubnetId,
        mut unpacked: UnpackedStreamSlice,
    ) -> CertifiedSliceResult<()> {
        // Trim off everything before the cached stream position.
        if let Some(cutoff) = self.stream_positions.get(&subnet_id) {
            unpacked = match unpacked.garbage_collect(cutoff)? {
                Some(unpacked) => unpacked,
                // Bail out if nothing left.
                None => return Ok(()),
            };
        }
        self.slices.insert(subnet_id, unpacked);
        Ok(())
    }
fn put_impl ( & mut self , subnet_id : SubnetId , mut unpacked : UnpackedStreamSlice , ) -> CertifiedSliceResult < ( ) > { // Trim off everything before the cached stream position. if let Some ( cutoff ) = self . stream_positions . get ( & subnet_id ) { unpacked = match unpacked . garbage_collect ( cutoff ) ? { Some ( unpacked ) => unpacked , // Bail out if nothing left. None => return Ok ( ( ) ) , } ; } self . slices . insert ( subnet_id , unpacked ) ; Ok ( ( ) ) }
Garbage collects the provided slice and pools the rest, if any.
Garbage collects the provided slice and pools the rest if any .
&mut self
subnet_id
SubnetId
unpacked
UnpackedStreamSlice