ArrayBuilder

Struct ArrayBuilder 

Source
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>>,

Source

pub fn of_values<E>( self, values: impl IntoIterator<Item = Result<Value, E>>, ) -> Self
where E: Error + Send + Sync + 'static,

Record an Iterator of parsing results for single values.

Source

pub fn of_structs<I, T, Parser>(self, elements: I, parse: Parser) -> Self
where I: IntoIterator<Item = T>, Parser: FnMut(StructBuilder<Self, Value, Nil>, T) -> 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.

Source

pub fn value<E>(self, index: usize, result: Result<Value, E>) -> Self
where E: Error + Send + Sync + 'static,

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.

Source

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.

Source

pub fn finish(self) -> Parent::AfterRecord

Finish the ArrayBuilder and pass the final result to the parent builder.

Trait Implementations§

Source§

impl<Parent: Debug, Value: Debug> Debug for ArrayBuilder<Parent, Value>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<Parent, Value> ErrorBuilderParent<Value> for ArrayBuilder<Parent, Value>

Source§

type AfterRecord = ArrayBuilder<Parent, Value>

The parent builder after the child builder finished. Read more
Source§

fn finish_child_builder( self, child_result: Result<Value, AccumulatedError>, ) -> Self::AfterRecord

Record the final result of the child builder.

Auto Trait Implementations§

§

impl<Parent, Value> Freeze for ArrayBuilder<Parent, Value>
where Parent: Freeze,

§

impl<Parent, Value> !RefUnwindSafe for ArrayBuilder<Parent, Value>

§

impl<Parent, Value> Send for ArrayBuilder<Parent, Value>
where Parent: Send, Value: Send,

§

impl<Parent, Value> Sync for ArrayBuilder<Parent, Value>
where Parent: Sync, Value: Sync,

§

impl<Parent, Value> Unpin for ArrayBuilder<Parent, Value>
where Parent: Unpin, Value: Unpin,

§

impl<Parent, Value> !UnwindSafe for ArrayBuilder<Parent, Value>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.