Trait extendr_api::na::CanBeNA

source ·
pub trait CanBeNA {
    // Required methods
    fn is_na(&self) -> bool;
    fn na() -> Self;
}
Expand description

Return true if this primitive is NA.

Required Methods§

source

fn is_na(&self) -> bool

source

fn na() -> Self

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl CanBeNA for &str

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);
}
source§

fn is_na(&self) -> bool

Check for NA in a string by address.

source§

fn na() -> Self

source§

impl CanBeNA for f64

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

fn is_na(&self) -> bool

source§

fn na() -> f64

source§

impl CanBeNA for i32

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

fn is_na(&self) -> bool

source§

fn na() -> i32

Implementors§

source§

impl CanBeNA for Rbool

use extendr_api::prelude::*;
test! {
    assert!((<Rbool>::na()).is_na());
}
source§

impl CanBeNA for Rcplx

use extendr_api::prelude::*;
test! {
    assert!((<Rcplx>::na()).is_na());
}
source§

impl CanBeNA for Rfloat

use extendr_api::prelude::*;
test! {
    assert!((<Rfloat>::na()).is_na());
}
source§

impl CanBeNA for Rint

use extendr_api::prelude::*;
test! {
    assert!((<Rint>::na()).is_na());
}
source§

impl CanBeNA for Rstr

source§

impl CanBeNA for c64