Skip to main content

coerce_slice_to_vec

Function coerce_slice_to_vec 

Source
fn coerce_slice_to_vec<R, T>(
    slice: &[R],
    container: &str,
) -> Result<Vec<T>, SexpError>
where R: Copy + TryCoerce<T>, <R as TryCoerce<T>>::Error: Display,
Expand description

Helper to coerce a slice element-wise into a Vec.

Walks the whole slice, accumulating every per-element coercion failure into one batched SexpError::InvalidValue via BatchedErrors (container names the target type, e.g. "Vec<bool>") instead of bailing on the first Err. The happy path allocates nothing for diagnostics, and a large all-failing slice never builds more than BATCHED_ERROR_CAP messages.