Metreeca Gear
    Preparing search index...

    Function validate

    • Creates a value validation task.

      The generated task retains the values a validator accepts and drops the ones it reports violations for, so that a consumer works on values already known to meet the constraints it expects.

      Note

      • Incremental: each retained value is emitted as soon as it is drawn, so the feed produced runs dry as the feed drawn from does and an endless source is read as long as it is consumed.
      • Streaming: values are validated one at a time and none held, so the length of the feed weighs on memory no more than a single value does.
      • Stateless: every value is validated on its own, so the outcome is unaffected by how the feed is split across nested feeds or runs.
      Warning

      A rejected value is dropped and reported to the log together with the trace listing every violation it incurs, leaving the feed to run to completion.

      Type Parameters

      • V

        The type of the validated values

      Parameters

      • validator: Validator<V>

        The validator applied to each value, reporting the trace of the violations the value incurs, or nothing if it meets every constraint

      Returns Task<V>

      A task retaining the values validator accepts

      Error While the feed is consumed, whatever the source reports while producing values, or whatever validator reports while validating one