Skip to main content

EnumerateLastPartial

This class provides an iterator wrapper that yields pairs of indices and elements while tracking whether the current item is the final element in the sequence. It supports a configurable partial mode to determine how the iteration behaves when encountering incomplete data or specific termination conditions.

Attributes

AttributeTypeDescription
iterI: IteratorThe underlying iterator being wrapped to provide enumeration and partial item tracking.
indexusizeThe current zero-based position in the sequence used to track the number of items yielded.
next_itemOption< I::Item >A lookahead buffer storing the subsequent element to determine if the current element is the final item in the sequence.
allow_partialPartialModeConfiguration setting that determines how the iterator handles incomplete or partial data segments.

Constructor

Signature

def EnumerateLastPartial(
iter: I,
index: usize,
next_item: Option< I::Item >,
allow_partial: PartialMode
) - > [EnumerateLastPartial](enumeratelastpartial.md?sid=validators_validation_state_enumeratelastpartial)

Parameters

NameTypeDescription
iterIThe underlying iterator to wrap.
indexusizeThe starting index for enumeration.
next_itemOption< I::Item >The initial next item in the sequence.
allow_partialPartialModeThe mode determining how partial results are handled.

Signature

@staticmethod
def new(
iter: I,
allow_partial: PartialMode
) - > [EnumerateLastPartial](enumeratelastpartial.md?sid=validators_validation_state_enumeratelastpartial)

Parameters

NameTypeDescription
iterIThe underlying iterator to be wrapped and enumerated.
allow_partialPartialModeThe configuration mode determining how partial or incomplete items at the end of the sequence are handled.