Skip to main content

collect_coerced

Function collect_coerced 

Source
fn collect_coerced<U>(
    len: usize,
    iter: impl Iterator<Item = Result<U, SexpError>>,
) -> Result<Vec<U>, SexpError>
Expand description

Drive a per-element coercion, batching every failure into one diagnostic.

Backs from_numeric_vec_with’s four SEXP-type branches: successes go into the output Vec, failures accumulate by reason and position via BatchedErrors (value out of range (elements 2, 3), the grammar of Vec<T> for a string-parsed type, see ParsedRStr). Each failure’s reason is SexpError::r_reason: an InvalidValue’s own text, NA is not allowed for an NA. The happy path allocates nothing for diagnostics, and a large all-failing vector never builds more than BATCHED_ERROR_CAP messages.