pub trait RFromStr: Sized {
// Required method
fn 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
from_str(s: &str)- 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 RFromStr for IpAddress {}In R:
ip <- IpAddress$from_str("192.168.1.1")Required Methods§
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.