pub unsafe fn gather_into_uninit<T, I>(
plan: &GatherPlan,
dest: &mut RawStridedMut<'_, MaybeUninit<T>>,
operand: &RawStridedRef<'_, T>,
start_indices: &RawStridedRef<'_, I>,
) -> Result<()>Expand description
Full-overwrite indexed replay for an operation-family adapter.
§Safety
The adapter must reject input/output overlap before creating the input references. All descriptor allocation and initialization contracts must remain valid for the call. Output slots may be uninitialized; the owning plan retains its checked layout/index validation and private initialization receipt. No initialized reference to the output backing may be formed. Gather into uninitialized output without exposing an initialization receipt.
§Examples
use strided_basic::{RawStridedRef, RawStridedMut};
use strided_basic::execution::*;
use core::mem::MaybeUninit;
use strided_basic::{GatherPlan, GatherSpec};
let spec = GatherSpec { offset_dims: vec![], collapsed_slice_dims: vec![0], start_index_map: vec![0], index_vector_dim: 1, slice_sizes: vec![1] };
let plan = GatherPlan::compile(&[3], &[1], &[2, 1], &[1, 2], &[2], &[1], spec).unwrap();
let src = RawStridedRef::new(&[1_i32, 2, 3], &[3], &[1], 0).unwrap();
let indices = RawStridedRef::new(&[0_i32, 2], &[2, 1], &[1, 2], 0).unwrap();
let mut values = [MaybeUninit::<i32>::uninit(); 2];
let mut dst = RawStridedMut::new(&mut values, &[2], &[1], 0).unwrap();
// SAFETY: input and output allocations are disjoint and layouts match the plan.
unsafe { gather_into_uninit(&plan, &mut dst, &src, &indices) }.unwrap();
assert_eq!(unsafe { values[1].assume_init() }, 3);§Errors
Forwards the plan layout/index validation errors before successful overwrite.