/// Garbage collects the payload by dropping all messages before `cutoff`.
/// Returns the pruned messages as a `LabeledTree`, to be used for witness
/// pruning.
///
/// Returns `Err(InvalidPayload)` if `self.messages` is malformed.
Garbage collects the payload by dropping all messages before `cutoff`.
Returns the pruned messages as a `LabeledTree`, to be used for witness
pruning.


Garbage collects the payload by dropping all messages before ` cutoff ` . Returns the pruned messages as a ` LabeledTree ` to be used for witness pruning .
pub fn garbage_collect(
        &mut self,
        cutoff: StreamIndex,
    ) -> CertifiedSliceResult<Option<PayloadTree>> {
        Ok(self
            .take_messages_prefix(&cutoff.to_label())?
            .map(|pruned_messages| {
                Payload::pack(self.subnet_id.clone(), None, Some(pruned_messages))
            }))
    }
pub fn garbage_collect ( & mut self , cutoff : StreamIndex , ) -> CertifiedSliceResult < Option < PayloadTree > > { Ok ( self . take_messages_prefix ( & cutoff . to_label ( ) ) ? . map ( | pruned_messages | { Payload :: pack ( self . subnet_id . clone ( ) , None , Some ( pruned_messages ) ) } ) ) }
Garbage collects the payload by dropping all messages before `cutoff`.
Garbage collects the payload by dropping all messages before ` cutoff ` .
&mut self
cutoff
StreamIndex