pub trait RFactor:
MatchArg
+ Copy
+ 'static {
// Required methods
fn to_level_index(self) -> i32;
fn from_level_index(idx: i32) -> Option<Self>;
}Expand description
Trait for mapping Rust enums to R factors.
Typically implemented via #[derive(RFactor)] for C-style enums.
The derive macro also generates IntoR and TryFromSexp implementations.
Required Methods§
Sourcefn to_level_index(self) -> i32
fn to_level_index(self) -> i32
Convert variant to 1-based level index.
Sourcefn from_level_index(idx: i32) -> Option<Self>
fn from_level_index(idx: i32) -> Option<Self>
Convert 1-based level index to variant, or None if out of range.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.