Skip to main content

compare_into_uninit

Function compare_into_uninit 

Source
pub fn compare_into_uninit<T, OpA, OpB>(
    dest: &mut StridedViewMut<'_, MaybeUninit<bool>>,
    a: &StridedView<'_, T, OpA>,
    b: &StridedView<'_, T, OpB>,
    op: CompareOp,
) -> Result<()>
where T: Copy + MaybeSendSync + PartialOrd, OpA: ElementOp<T>, OpB: ElementOp<T>,
Expand description

Compare two views into a fully overwritten uninitialized Boolean output.

Dtype-independent shape, destination-injectivity, and reachable-byte overlap validation completes before the first write. Safe Rust borrows already prevent input/output aliasing; the explicit overlap check preserves the contract for views produced through unsafe constructors.

Ok(()) means every logical destination element is initialized. An error occurs before writes. A panic during replay may leave a partially initialized destination, which remains safe to drop as MaybeUninit<bool>.

ยงErrors

Returns StridedError::ShapeMismatch for unequal shapes, StridedError::NonInjectiveOutputLayout for an overlapping output layout, StridedError::OverlappingInputOutput for aliased storage, or StridedError::OffsetOverflow when a reachable byte range is not representable.