Trait oso::FromPolar

source ·
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§

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl FromPolar for bool

source§

impl FromPolar for f64

source§

impl FromPolar for i8

source§

impl FromPolar for i16

source§

impl FromPolar for i32

source§

impl FromPolar for i64

source§

impl FromPolar for u8

source§

impl FromPolar for u16

source§

impl FromPolar for u32

source§

impl FromPolar for String

source§

impl<T: Eq + Ord + FromPolar> FromPolar for BTreeSet<T>

source§

impl<T: Eq + Hash + FromPolar> FromPolar for HashSet<T>

source§

impl<T: Ord + FromPolar> FromPolar for BinaryHeap<T>

source§

impl<T: FromPolar> FromPolar for Option<T>

source§

impl<T: FromPolar> FromPolar for BTreeMap<String, T>

source§

impl<T: FromPolar> FromPolar for LinkedList<T>

source§

impl<T: FromPolar> FromPolar for VecDeque<T>

source§

impl<T: FromPolar> FromPolar for Vec<T>

source§

impl<T: FromPolar> FromPolar for HashMap<String, T>

Implementors§

source§

impl FromPolar for PolarValue

source§

impl<T> FromPolar for T
where T: 'static + Clone + PolarClass,

source§

impl<T: FromPolar> FromPolar for Action<T>