Skip to main content

coerce_slice_to_vec

Function coerce_slice_to_vec 

Source
fn coerce_slice_to_vec<R, T>(slice: &[R]) -> 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 (value out of range (elements 2, 3)) 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.