pub unsafe fn map_into_validated<D, A, Op>(
dest: &mut StridedViewMut<'_, D>,
src: &StridedView<'_, A, Op>,
f: impl Fn(A) -> D + MaybeSync,
validated: ValidatedDestinationLayout,
) -> Result<(), StridedError>Expand description
Prevalidated map into validated for kernel-family implementations.
§Safety
All input shapes must match the destination. validated must have been
obtained for this destination’s current geometry, proving injectivity;
possessing a marker from another layout is not sufficient. View/descriptor
bounds and aliasing contracts must continue to hold throughout replay.
§Examples
use strided_basic::execution::*;
// SAFETY: the example supplies matching bounded layouts and disjoint storage.
use strided_basic::StridedArray;
let src = StridedArray::<f64>::from_parts(vec![2.0; 2], &[2], &[1], 0).unwrap();
let mut dst = StridedArray::<f64>::col_major(&[2]);
let checked = validate_destination_layout_without_alloc(&[2], &[1]).unwrap();
unsafe { map_into_validated(&mut dst.view_mut(), &src.view(), |a| a, checked) }.unwrap();
assert_eq!(dst.get(&[1]), 2.0);§Errors
Forwards errors from the owning kernel or callback; callers must still satisfy the safety contract before invoking this prevalidated entry.