fn collect_with_consumer<T, F>(vec: &mut Vec<T>, len: usize, scope_fn: F)where
    T: Send,
    F: FnOnce(CollectConsumer<'_, T>) -> CollectResult<'_, T>,
Expand description

Create a consumer on the slice of memory we are collecting into.

The consumer needs to be used inside the scope function, and the complete collect result passed back.

This method will verify the collect result, and panic if the slice was not fully written into. Otherwise, in the successful case, the vector is complete with the collected result.