/rust/registry/src/index.crates.io-6f17d22bba15001f/ndarray-0.15.6/src/extension/nonnull.rs
Line | Count | Source (jump to first uncovered line) |
1 | | use std::ptr::NonNull; |
2 | | use alloc::vec::Vec; |
3 | | |
4 | | /// Return a NonNull<T> pointer to the vector's data |
5 | 0 | pub(crate) fn nonnull_from_vec_data<T>(v: &mut Vec<T>) -> NonNull<T> { |
6 | 0 | // this pointer is guaranteed to be non-null |
7 | 0 | unsafe { NonNull::new_unchecked(v.as_mut_ptr()) } |
8 | 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::<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::<_> |
9 | | |
10 | | /// Converts `ptr` to `NonNull<T>` |
11 | | /// |
12 | | /// Safety: `ptr` *must* be non-null. |
13 | | /// This is checked with a debug assertion, and will panic if this is not true, |
14 | | /// but treat this as an unconditional conversion. |
15 | | #[inline] |
16 | 0 | pub(crate) unsafe fn nonnull_debug_checked_from_ptr<T>(ptr: *mut T) -> NonNull<T> { |
17 | 0 | debug_assert!(!ptr.is_null()); |
18 | 0 | NonNull::new_unchecked(ptr) |
19 | 0 | } Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<f64> Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<f32> Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<i32> Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<i16> Unexecuted instantiation: ndarray::extension::nonnull::nonnull_debug_checked_from_ptr::<i64> 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::<_> |