Trait oso::FromPolar [−][src]
pub trait FromPolar: Clone {
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