pub struct FieldBuilder<Parent, Value, List> { /* private fields */ }
Expand description
A builder to record parsing results for a field of the input.
Implementations§
Source§impl<Parent, Value, List> FieldBuilder<Parent, Value, List>where
Parent: ErrorBuilderParent<Value>,
impl<Parent, Value, List> FieldBuilder<Parent, Value, List>where
Parent: ErrorBuilderParent<Value>,
Sourcepub fn value<T, E>(
self,
result: Result<T, E>,
) -> FieldBuilder<Parent, Value, List::Output>
pub fn value<T, E>( self, result: Result<T, E>, ) -> FieldBuilder<Parent, Value, List::Output>
Record a parsing result for the field.
Sourcepub fn value_ok<T>(self, value: T) -> FieldBuilder<Parent, Value, List::Output>where
List: Append<T>,
pub fn value_ok<T>(self, value: T) -> FieldBuilder<Parent, Value, List::Output>where
List: Append<T>,
Record a value for the field.
This is infallible so it’s easy to insert values that do not need
parsing in the ErrorAccumulator
’s system.
Sourcepub fn with_previous<Valid, T, E>(
self,
validator: Valid,
) -> FieldBuilder<Parent, Value, List::Output>where
Valid: ListValidator<List, T, E>,
List: AsRefTuple + Append<T>,
E: Error + Send + Sync + 'static,
pub fn with_previous<Valid, T, E>(
self,
validator: Valid,
) -> FieldBuilder<Parent, Value, List::Output>where
Valid: ListValidator<List, T, E>,
List: AsRefTuple + Append<T>,
E: Error + Send + Sync + 'static,
Run another validation step on the previously recorded Ok
values if
there were no errors yet.
In case an error was already recorded the validator
is not executed.
For an example, see the docs of
StructBuilder::with_previous()
.
Sourcepub fn on_ok<C>(self, constructor: C) -> BuilderFinisher<Parent, Value, List, C>where
List: ToTuple,
C: Constructor<List::List, Value>,
pub fn on_ok<C>(self, constructor: C) -> BuilderFinisher<Parent, Value, List, C>where
List: ToTuple,
C: Constructor<List::List, Value>,
Provide a Constructor
to convert the recorded Ok
values into the
target type.
Source§impl<Parent, Value> FieldBuilder<Parent, Value, Cons<Value, Nil>>where
Parent: ErrorBuilderParent<Value>,
impl<Parent, Value> FieldBuilder<Parent, Value, Cons<Value, Nil>>where
Parent: ErrorBuilderParent<Value>,
Sourcepub fn finish(self) -> Parent::AfterRecord
pub fn finish(self) -> Parent::AfterRecord
Finish the builder and pass the builder’s final result to the parent builder.
Trait Implementations§
Auto Trait Implementations§
impl<Parent, Value, List> Freeze for FieldBuilder<Parent, Value, List>
impl<Parent, Value, List> !RefUnwindSafe for FieldBuilder<Parent, Value, List>
impl<Parent, Value, List> Send for FieldBuilder<Parent, Value, List>
impl<Parent, Value, List> Sync for FieldBuilder<Parent, Value, List>
impl<Parent, Value, List> Unpin for FieldBuilder<Parent, Value, List>
impl<Parent, Value, List> !UnwindSafe for FieldBuilder<Parent, Value, List>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more