Enum oso::PolarValue
source · pub enum PolarValue {
Integer(i64),
Float(f64),
String(String),
Boolean(bool),
Map(HashMap<String, PolarValue>),
List(Vec<PolarValue>),
Variable(String),
Instance(Instance),
}
Expand description
An enum of the possible value types that can be sent to/from Polar.
All variants except Instance
represent types that can
be used natively in Polar.
Any other types can be wrapped using PolarValue::new_from_instance
.
If the instance has a registered Class
, then this can be used
from the policy too.
Variants§
Integer(i64)
Float(f64)
String(String)
Boolean(bool)
Map(HashMap<String, PolarValue>)
List(Vec<PolarValue>)
Variable(String)
Instance(Instance)
Implementations§
source§impl PolarValue
impl PolarValue
sourcepub fn new_from_instance<T>(instance: T) -> Self
pub fn new_from_instance<T>(instance: T) -> Self
Create a PolarValue::Instance
from any type.
Trait Implementations§
source§impl Clone for PolarValue
impl Clone for PolarValue
source§fn clone(&self) -> PolarValue
fn clone(&self) -> PolarValue
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for PolarValue
impl Debug for PolarValue
source§impl FromPolar for PolarValue
impl FromPolar for PolarValue
fn from_polar(val: PolarValue) -> Result<Self>
source§impl PartialEq for PolarValue
impl PartialEq for PolarValue
source§fn eq(&self, other: &PolarValue) -> bool
fn eq(&self, other: &PolarValue) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl ToPolar for PolarValue
impl ToPolar for PolarValue
source§fn to_polar(self) -> PolarValue
fn to_polar(self) -> PolarValue
Convert this value into a Polar value.
source§impl TryFrom<PolarValue> for String
impl TryFrom<PolarValue> for String
source§impl TryFrom<PolarValue> for bool
impl TryFrom<PolarValue> for bool
source§impl TryFrom<PolarValue> for f64
impl TryFrom<PolarValue> for f64
source§impl TryFrom<PolarValue> for i16
impl TryFrom<PolarValue> for i16
source§impl TryFrom<PolarValue> for i32
impl TryFrom<PolarValue> for i32
source§impl TryFrom<PolarValue> for i64
impl TryFrom<PolarValue> for i64
source§impl TryFrom<PolarValue> for i8
impl TryFrom<PolarValue> for i8
source§impl TryFrom<PolarValue> for u16
impl TryFrom<PolarValue> for u16
source§impl TryFrom<PolarValue> for u32
impl TryFrom<PolarValue> for u32
Auto Trait Implementations§
impl !RefUnwindSafe for PolarValue
impl Send for PolarValue
impl Sync for PolarValue
impl Unpin for PolarValue
impl !UnwindSafe for PolarValue
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more