pub trait FromPolar: Clone {
// Required method
fn from_polar(val: PolarValue) -> Result<Self>;
}Expand description
Convert Polar types to Rust types.
This trait is automatically implemented for any
type that implements the PolarClass trait,
which should be preferred.
This is also implemented automatically using the
#[derive(PolarClass)] macro.
§Trait bounds
FromPolar requires Clone because we can only
get a borrowed value back from oso. In the future, this could
be updated to return borrowed data instead.
The default implementation for PolarClass
also requires types to be Send + Sync, since it
is possible to store a FromPolar value on an Oso instance
which can be shared between threads
Required Methods§
fn from_polar(val: PolarValue) -> Result<Self>
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.