Skip to main content

IsNA

Trait IsNA 

Source
pub trait IsNA: RNativeType {
    // Required method
    fn is_na(&self) -> bool;
}
Expand description

Native R elements with an actual NA representation.

This is the missing-value capability bound for native buffers. It excludes u8: R raw vectors have no NA, even though RNativeType::R_NA uses zero to fill absent raw positions. The existing R_NA constant constructs the sentinel; is_na recognizes it, including computed real NAs.

For floating point this follows R’s R_IsNA, not R’s is.na() or anyNA(): ordinary NaNs are not NA sentinels. In particular, ALTREP no_na hints must still reject ordinary NaNs too.

Rust values without native NA storage use Option<T> at conversion boundaries; no additional NA<T> wrapper is needed. Native newtypes can use #[derive(IsNA)] to forward this check to their single field.

Required Methods§

Source

fn is_na(&self) -> bool

Whether this element is R’s NA sentinel.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl IsNA for f64

Source§

fn is_na(&self) -> bool

Source§

impl IsNA for i32

Source§

fn is_na(&self) -> bool

Implementors§