logo
pub trait CanBeNA {
    fn is_na(&self) -> bool;
fn na() -> Self; }
Expand description

Return true if this primitive is NA.

Required methods

Implementations on Foreign Types

use extendr_api::prelude::*;
test! {
    assert!(f64::na().is_na());
}
use extendr_api::prelude::*;
test! {
    assert!(i32::na().is_na());
}

Special “NA” string that represents null strings.

use extendr_api::prelude::*;
test! {
    assert_ne!(<&str>::na().as_ptr(), "NA".as_ptr());
    assert_eq!(<&str>::na(), "NA");
    assert_eq!("NA".is_na(), false);
    assert_eq!(<&str>::na().is_na(), true);
}

Check for NA in a string by address.

Implementors

use extendr_api::prelude::*;
test! {
    assert!((<Rbool>::na()).is_na());
}
use extendr_api::prelude::*;
test! {
    assert!((<Rcplx>::na()).is_na());
}
use extendr_api::prelude::*;
test! {
    assert!((<Rfloat>::na()).is_na());
}
use extendr_api::prelude::*;
test! {
    assert!((<Rint>::na()).is_na());
}