MCPcopy Create free account
hub / github.com/docknetwork/crypto / validate

Function validate

utils/src/iter.rs:37–43  ·  view source on GitHub ↗

Ensures that the given iterator satisfies provided validator for each item. In case of an error, `Err(V::Failure)` will be emitted.

(iter: I, validator: V)

Source from the content-addressed store, hash-verified

35/// Ensures that the given iterator satisfies provided validator for each item.
36/// In case of an error, `Err(V::Failure)` will be emitted.
37pub fn validate<I, V>(iter: I, validator: V) -> impl Iterator<Item = Result<I::Item, V::Failure>>
38where
39 I: IntoIterator,
40 V: SeqValidator<I::Item>,
41{
42 try_validate(iter.into_iter().map(Ok), validator)
43}
44
45/// Maps supplied iterator and attempts to pair each successfully validated item
46/// with a corresponding item from the slice.

Callers 4

seq_pairs_satisfyFunction · 0.70
take_while_satisfyFunction · 0.70
newMethod · 0.50

Calls 3

try_validateFunction · 0.85
mapMethod · 0.80
into_iterMethod · 0.45

Tested by

no test coverage detected