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
| Attribute | Type | Description |
|---|---|---|
| iter | I: Iterator | The underlying iterator being wrapped to provide enumeration and partial item tracking. |
| index | usize | The current zero-based position in the sequence used to track the number of items yielded. |
| next_item | Option< I::Item > | A lookahead buffer storing the subsequent element to determine if the current element is the final item in the sequence. |
| allow_partial | PartialMode | Configuration 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
| Name | Type | Description |
|---|---|---|
| iter | I | The underlying iterator to wrap. |
| index | usize | The starting index for enumeration. |
| next_item | Option< I::Item > | The initial next item in the sequence. |
| allow_partial | PartialMode | The 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
| Name | Type | Description |
|---|---|---|
| iter | I | The underlying iterator to be wrapped and enumerated. |
| allow_partial | PartialMode | The configuration mode determining how partial or incomplete items at the end of the sequence are handled. |