Struct extendr_api::scalar::Rbool
source · pub struct Rbool(_);
Expand description
Rbool is a wrapper for i32 in the context of an R’s logical vector.
Rbool can have a value of 0, 1 or i32::MIN.
The value i32::MIN is used as “NA”.
Rbool has the same footprint as an i32 value allowing us to use it in zero copy slices.
Implementations§
source§impl Rbool
impl Rbool
sourcepub const fn true_value() -> Rbool
pub const fn true_value() -> Rbool
Return a true
Rbool
.
sourcepub const fn false_value() -> Rbool
pub const fn false_value() -> Rbool
Return a false
Rbool
.
Trait Implementations§
source§impl<'a> AsTypedSlice<'a, Rbool> for Robjwhere
Self: 'a,
impl<'a> AsTypedSlice<'a, Rbool> for Robjwhere Self: 'a,
fn as_typed_slice(&self) -> Option<&'a [Rbool]>
fn as_typed_slice_mut(&mut self) -> Option<&'a mut [Rbool]>
source§impl CanBeNA for Rbool
impl CanBeNA for Rbool
use extendr_api::prelude::*;
test! {
assert!((<Rbool>::na()).is_na());
}
source§impl Default for Rbool
impl Default for Rbool
use extendr_api::prelude::*;
test! {
assert_eq!(<Rbool>::default(), <bool>::default());
}
source§impl FromIterator<Rbool> for Logicals
impl FromIterator<Rbool> for Logicals
source§fn from_iter<T: IntoIterator<Item = Rbool>>(iter: T) -> Self
fn from_iter<T: IntoIterator<Item = Rbool>>(iter: T) -> Self
A more generalised iterator collector for small vectors. Generates a non-ALTREP vector.
source§impl PartialEq<Rbool> for Rbool
impl PartialEq<Rbool> for Rbool
use extendr_api::prelude::*;
test! {
assert!(<Rbool>::default().eq(&<Rbool>::default()));
assert!(!<Rbool>::na().eq(&<Rbool>::na()));
}
source§impl PartialEq<bool> for &Rbool
impl PartialEq<bool> for &Rbool
use extendr_api::prelude::*;
test! {
assert!(<Rbool>::default().eq(&<bool>::default()));
}
source§impl PartialEq<bool> for Rbool
impl PartialEq<bool> for Rbool
use extendr_api::prelude::*;
test! {
assert!(<Rbool>::default().eq(&<bool>::default()));
}