Trait ndarray_stats::MaybeNan

source ·
pub trait MaybeNan: Sized {
    type NotNan;

    // Required methods
    fn is_nan(&self) -> bool;
    fn try_as_not_nan(&self) -> Option<&Self::NotNan>;
    fn from_not_nan(_: Self::NotNan) -> Self;
    fn from_not_nan_opt(_: Option<Self::NotNan>) -> Self;
    fn from_not_nan_ref_opt(_: Option<&Self::NotNan>) -> &Self;
    fn remove_nan_mut(
        _: ArrayViewMut1<'_, Self>,
    ) -> ArrayViewMut1<'_, Self::NotNan>;
}
Expand description

A number type that can have not-a-number values.

Required Associated Types§

source

type NotNan

A type that is guaranteed not to be a NaN value.

Required Methods§

source

fn is_nan(&self) -> bool

Returns true if the value is a NaN value.

source

fn try_as_not_nan(&self) -> Option<&Self::NotNan>

Tries to convert the value to NotNan.

Returns None if the value is a NaN value.

source

fn from_not_nan(_: Self::NotNan) -> Self

Converts the value.

If the value is None, a NaN value is returned.

source

fn from_not_nan_opt(_: Option<Self::NotNan>) -> Self

Converts the value.

If the value is None, a NaN value is returned.

source

fn from_not_nan_ref_opt(_: Option<&Self::NotNan>) -> &Self

Converts the value.

If the value is None, a NaN value is returned.

source

fn remove_nan_mut(_: ArrayViewMut1<'_, Self>) -> ArrayViewMut1<'_, Self::NotNan>

Returns a view with the NaN values removed.

This modifies the input view by moving elements as necessary. The final order of the elements is unspecified. However, this method is idempotent, and given the same input data, the result is always ordered the same way.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl MaybeNan for Option<i8>

§

type NotNan = NotNone<i8>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<i8>>

source§

fn from_not_nan(value: NotNone<i8>) -> Option<i8>

source§

fn from_not_nan_opt(value: Option<NotNone<i8>>) -> Option<i8>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<i8>>) -> &Option<i8>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<i16>

§

type NotNan = NotNone<i16>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<i16>>

source§

fn from_not_nan(value: NotNone<i16>) -> Option<i16>

source§

fn from_not_nan_opt(value: Option<NotNone<i16>>) -> Option<i16>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<i16>>) -> &Option<i16>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<i32>

§

type NotNan = NotNone<i32>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<i32>>

source§

fn from_not_nan(value: NotNone<i32>) -> Option<i32>

source§

fn from_not_nan_opt(value: Option<NotNone<i32>>) -> Option<i32>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<i32>>) -> &Option<i32>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<i64>

§

type NotNan = NotNone<i64>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<i64>>

source§

fn from_not_nan(value: NotNone<i64>) -> Option<i64>

source§

fn from_not_nan_opt(value: Option<NotNone<i64>>) -> Option<i64>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<i64>>) -> &Option<i64>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<i128>

§

type NotNan = NotNone<i128>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<i128>>

source§

fn from_not_nan(value: NotNone<i128>) -> Option<i128>

source§

fn from_not_nan_opt(value: Option<NotNone<i128>>) -> Option<i128>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<i128>>) -> &Option<i128>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<u8>

§

type NotNan = NotNone<u8>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<u8>>

source§

fn from_not_nan(value: NotNone<u8>) -> Option<u8>

source§

fn from_not_nan_opt(value: Option<NotNone<u8>>) -> Option<u8>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<u8>>) -> &Option<u8>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<u16>

§

type NotNan = NotNone<u16>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<u16>>

source§

fn from_not_nan(value: NotNone<u16>) -> Option<u16>

source§

fn from_not_nan_opt(value: Option<NotNone<u16>>) -> Option<u16>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<u16>>) -> &Option<u16>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<u32>

§

type NotNan = NotNone<u32>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<u32>>

source§

fn from_not_nan(value: NotNone<u32>) -> Option<u32>

source§

fn from_not_nan_opt(value: Option<NotNone<u32>>) -> Option<u32>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<u32>>) -> &Option<u32>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<u64>

§

type NotNan = NotNone<u64>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<u64>>

source§

fn from_not_nan(value: NotNone<u64>) -> Option<u64>

source§

fn from_not_nan_opt(value: Option<NotNone<u64>>) -> Option<u64>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<u64>>) -> &Option<u64>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<u128>

§

type NotNan = NotNone<u128>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<u128>>

source§

fn from_not_nan(value: NotNone<u128>) -> Option<u128>

source§

fn from_not_nan_opt(value: Option<NotNone<u128>>) -> Option<u128>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<u128>>) -> &Option<u128>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<N32>

§

type NotNan = NotNone<NoisyFloat<f32, NumChecker>>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<N32>>

source§

fn from_not_nan(value: NotNone<N32>) -> Option<N32>

source§

fn from_not_nan_opt(value: Option<NotNone<N32>>) -> Option<N32>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<N32>>) -> &Option<N32>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for Option<N64>

§

type NotNan = NotNone<NoisyFloat<f64, NumChecker>>

source§

fn is_nan(&self) -> bool

source§

fn try_as_not_nan(&self) -> Option<&NotNone<N64>>

source§

fn from_not_nan(value: NotNone<N64>) -> Option<N64>

source§

fn from_not_nan_opt(value: Option<NotNone<N64>>) -> Option<N64>

source§

fn from_not_nan_ref_opt(value: Option<&NotNone<N64>>) -> &Option<N64>

source§

fn remove_nan_mut( view: ArrayViewMut1<'_, Self>, ) -> ArrayViewMut1<'_, Self::NotNan>

source§

impl MaybeNan for f32

source§

impl MaybeNan for f64

Implementors§