pub trait RFromStr: Sized {
// Required method
fn r_from_str(s: &str) -> Option<Self>;
}Expand description
Adapter trait for std::str::FromStr.
Provides string parsing for R, allowing R strings to be parsed into Rust types.
Automatically implemented for any type that implements FromStr.
§Methods
r_from_str(s: &str)(from_str()in R) - Parse a string into this type, returning None on failure
§Example
ⓘ
use std::net::IpAddr;
// IpAddr implements FromStr
#[derive(ExternalPtr)]
struct IpAddress(IpAddr);
#[miniextendr]
impl miniextendr_api::adapter_traits::RFromStr for IpAddress {}In R:
ip <- IpAddress$RFromStr$from_str("192.168.1.1")Required Methods§
Sourcefn r_from_str(s: &str) -> Option<Self>
fn r_from_str(s: &str) -> Option<Self>
Parse a string into this type.
Returns Some(value) on success, None on parse failure, which R
receives as NULL.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".