Enum cedar_policy_core::ast::Value
source · pub enum Value {
Lit(Literal),
Set(Set),
Record(Arc<BTreeMap<SmolStr, Value>>),
ExtensionValue(Arc<ExtensionValueWithArgs>),
}
Expand description
This describes all the values which could be the dynamic result of evaluating an Expr
.
Cloning is O(1).
Variants§
Lit(Literal)
anything that is a Literal can also be the dynamic result of evaluating an Expr
Set(Set)
Evaluating an Expr
can result in a first-class set
Record(Arc<BTreeMap<SmolStr, Value>>)
Evaluating an Expr
can result in a first-class anonymous record (keyed on String)
ExtensionValue(Arc<ExtensionValueWithArgs>)
Evaluating an Expr
can result in an extension value
Implementations§
source§impl Value
impl Value
sourcepub fn empty_record() -> Self
pub fn empty_record() -> Self
Create a new empty record
sourcepub fn set(vals: impl IntoIterator<Item = Value>) -> Self
pub fn set(vals: impl IntoIterator<Item = Value>) -> Self
Create a set with the given Value
s as elements
sourcepub fn set_of_lits(lits: impl IntoIterator<Item = Literal>) -> Self
pub fn set_of_lits(lits: impl IntoIterator<Item = Literal>) -> Self
Create a set with the given Literal
s as elements
Trait Implementations§
source§impl<'de> Deserialize<'de> for Value
impl<'de> Deserialize<'de> for Value
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<S> From<BTreeMap<S, Value>> for Value
impl<S> From<BTreeMap<S, Value>> for Value
Create a Value::Record
from a map of String
to Value
source§impl<S> From<HashMap<S, Value>> for Value
impl<S> From<HashMap<S, Value>> for Value
As above, create a Value::Record
from a map of SmolStr
to Value
.
This implementation provides conversion from HashMap
while the earlier
implementation provides conversion from BTreeMap
source§impl<T: Into<Literal>> From<T> for Value
impl<T: Into<Literal>> From<T> for Value
Create a Value
directly from a Literal
, or from anything that implements
Into<Literal>
(so i64
, &str
, EntityUID
, etc)
source§impl From<Vec<(SmolStr, Value)>> for Value
impl From<Vec<(SmolStr, Value)>> for Value
Create a Value
directly from a Vec
of (String, Value)
pairs, which
will be interpreted as (field, value) pairs for a first-class record
source§impl<T: Into<Value>> From<Vec<T>> for Value
impl<T: Into<Value>> From<Vec<T>> for Value
Create a Value
directly from a Vec<Value>
, or Vec<T> where T: Into<Value>
(so Vec<i64>
, Vec<String>
, etc)
source§impl FromIterator<Value> for Set
impl FromIterator<Value> for Set
source§impl Ord for Value
impl Ord for Value
source§impl PartialOrd for Value
impl PartialOrd for Value
source§impl TryFrom<PartialValue> for Value
impl TryFrom<PartialValue> for Value
impl Eq for Value
Auto Trait Implementations§
impl Freeze for Value
impl !RefUnwindSafe for Value
impl !Send for Value
impl !Sync for Value
impl Unpin for Value
impl !UnwindSafe for Value
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more