pub trait FromPythonString: Sized {
// Required methods
fn from_python_string(s: &str) -> Option<Self>;
fn unknown() -> Self;
// Provided method
fn parse_or_unknown(s: &str) -> Self { ... }
}
Expand description
Helper trait for converting Python string literals to enum variants.
Required Methods§
Sourcefn from_python_string(s: &str) -> Option<Self>
fn from_python_string(s: &str) -> Option<Self>
Convert a Python operator string to the enum variant.
Provided Methods§
Sourcefn parse_or_unknown(s: &str) -> Self
fn parse_or_unknown(s: &str) -> Self
Parse from string with fallback to unknown.
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.