pub struct ArrayBuilder<Parent, Value> { /* private fields */ }
Expand description
A builder to record the parsing results of elements of an array in the input.
Arrays can be composed of single values or nested structs.
Implementations§
Source§impl<Parent, Value> ArrayBuilder<Parent, Value>where
Parent: ErrorBuilderParent<Vec<Value>>,
impl<Parent, Value> ArrayBuilder<Parent, Value>where
Parent: ErrorBuilderParent<Vec<Value>>,
Sourcepub fn of_values<E>(
self,
values: impl IntoIterator<Item = Result<Value, E>>,
) -> Self
pub fn of_values<E>( self, values: impl IntoIterator<Item = Result<Value, E>>, ) -> Self
Record an Iterator
of parsing results for single values.
Sourcepub fn of_structs<I, T, Parser>(self, elements: I, parse: Parser) -> Self
pub fn of_structs<I, T, Parser>(self, elements: I, parse: Parser) -> Self
Consume an Iterator
of nested structs from the input recording
errors while parsing.
The provided Parser
is a closure that receives a StructBuilder
for
the element that’s passed into the parser as well. Use the
StructBuilder
to record any parsing results while processing the
element.
Sourcepub fn value<E>(self, index: usize, result: Result<Value, E>) -> Self
pub fn value<E>(self, index: usize, result: Result<Value, E>) -> Self
Record a parsing results for a single value within the array at a certain index.
This is a low-level operation, consider using
of_values()
instead.
Sourcepub fn strukt(self, index: usize) -> StructBuilder<Self, Value, Nil>
pub fn strukt(self, index: usize) -> StructBuilder<Self, Value, Nil>
Start a StructBuilder
to record the parsing results for a nested
struct within the array at a certain index.
Sourcepub fn finish(self) -> Parent::AfterRecord
pub fn finish(self) -> Parent::AfterRecord
Finish the ArrayBuilder
and pass the final result to the parent
builder.