Coverage Report

Created: 2026-03-23 07:13

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/ndarray-0.17.2/src/extension/nonnull.rs
Line
Count
Source
1
#[cfg(not(feature = "std"))]
2
use alloc::vec::Vec;
3
use std::ptr::NonNull;
4
5
/// Return a NonNull<T> pointer to the vector's data
6
0
pub(crate) fn nonnull_from_vec_data<T>(v: &mut Vec<T>) -> NonNull<T>
7
{
8
    // this pointer is guaranteed to be non-null
9
0
    unsafe { NonNull::new_unchecked(v.as_mut_ptr()) }
10
0
}
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_from_vec_data::<core::mem::maybe_uninit::MaybeUninit<f64>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_from_vec_data::<core::mem::maybe_uninit::MaybeUninit<f32>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_from_vec_data::<f64>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_from_vec_data::<f32>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_from_vec_data::<i32>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_from_vec_data::<i16>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_from_vec_data::<i64>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_from_vec_data::<_>
11
12
/// Converts `ptr` to `NonNull<T>`
13
///
14
/// Safety: `ptr` *must* be non-null.
15
/// This is checked with a debug assertion, and will panic if this is not true,
16
/// but treat this as an unconditional conversion.
17
#[inline]
18
0
pub(crate) unsafe fn nonnull_debug_checked_from_ptr<T>(ptr: *mut T) -> NonNull<T>
19
{
20
0
    debug_assert!(!ptr.is_null());
21
0
    NonNull::new_unchecked(ptr)
22
0
}
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<noisy_float::NoisyFloat<f64, noisy_float::checkers::NumChecker>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<noisy_float::NoisyFloat<f32, noisy_float::checkers::NumChecker>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<noisy_float::NoisyFloat<f64, noisy_float::checkers::NumChecker>>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<noisy_float::NoisyFloat<f32, noisy_float::checkers::NumChecker>>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<i8>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<u8>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<i32>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<u32>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<i128>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<u128>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<i16>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<u16>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<i64>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<ndarray_stats::maybe_nan::NotNone<u64>>
Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<_>