CelValue

Enum CelValue 

Source
pub enum CelValue {
Show 18 variants Int(i64), UInt(u64), Float(f64), Bool(bool), String(String), Bytes(CelBytes), List(Vec<CelValue>), Map(HashMap<String, CelValue>), Null, Ident(String), Type(String), TimeStamp(DateTime<Utc>), Duration(Duration), ByteCode(CelByteCode), Message(Box<dyn MessageDyn>), Enum { descriptor: EnumDescriptor, value: i32, }, Dyn(Arc<dyn CelValueDyn>), Err(CelError),
}
Expand description

The basic value of the CEL interpreter.

Houses all possible types and implements most of the valid operations within the interpreter

Variants§

§

Int(i64)

§

UInt(u64)

§

Float(f64)

§

Bool(bool)

§

String(String)

§

Bytes(CelBytes)

§

List(Vec<CelValue>)

§

Map(HashMap<String, CelValue>)

§

Null

§

Ident(String)

§

Type(String)

§

TimeStamp(DateTime<Utc>)

§

Duration(Duration)

§

ByteCode(CelByteCode)

§

Message(Box<dyn MessageDyn>)

§

Enum

Fields

§descriptor: EnumDescriptor
§value: i32
§

Dyn(Arc<dyn CelValueDyn>)

§

Err(CelError)

Implementations§

Source§

impl CelValue

Source

pub fn from_int(val: i64) -> CelValue

Source

pub fn from_uint(val: u64) -> CelValue

Source

pub fn from_float(val: f64) -> CelValue

Source

pub fn from_bool(val: bool) -> CelValue

Source

pub fn true_() -> CelValue

Source

pub fn false_() -> CelValue

Source

pub fn from_string(val: String) -> CelValue

Source

pub fn from_str(val: &str) -> CelValue

Source

pub fn from_bytes(val: Vec<u8>) -> CelValue

Source

pub fn from_byte_slice(val: &[u8]) -> CelValue

Source

pub fn from_list(val: Vec<CelValue>) -> CelValue

Source

pub fn from_val_slice(val: &[CelValue]) -> CelValue

Source

pub fn from_map(val: HashMap<String, CelValue>) -> CelValue

Source

pub fn from_null() -> CelValue

Source

pub fn from_ident(val: &str) -> CelValue

Source

pub fn from_proto_msg(val: Box<dyn MessageDyn>) -> CelValue

Source

pub fn from_proto_enum(descriptor: EnumDescriptor, value: i32) -> CelValue

Source

pub fn from_type(val: &str) -> CelValue

Source

pub fn from_timestamp(val: DateTime<Utc>) -> CelValue

Source

pub fn from_duration(val: Duration) -> CelValue

Source

pub fn from_dyn(val: Arc<dyn CelValueDyn>) -> CelValue

Source

pub fn from_err(val: CelError) -> CelValue

Source

pub fn value_error(msg: &str) -> CelValue

Source

pub fn argument_error(msg: &str) -> CelValue

Source

pub fn internal_error(msg: &str) -> CelValue

Source

pub fn invalid_op_error(msg: &str) -> CelValue

Source

pub fn runtime_error(msg: &str) -> CelValue

Source

pub fn binding_error(sym_name: &str) -> CelValue

Source

pub fn attribute(parent_name: &str, field_name: &str) -> CelError

Source

pub fn into_result(self) -> CelResult<CelValue>

Source

pub fn is_true(&self) -> bool

Source

pub fn is_err(&self) -> bool

Source

pub fn is_obj(&self) -> bool

Source

pub fn is_zero(&self) -> bool

Source

pub fn int_type() -> CelValue

Source

pub fn uint_type() -> CelValue

Source

pub fn float_type() -> CelValue

Source

pub fn bool_type() -> CelValue

Source

pub fn string_type() -> CelValue

Source

pub fn bytes_type() -> CelValue

Source

pub fn list_type() -> CelValue

Source

pub fn map_type() -> CelValue

Source

pub fn null_type() -> CelValue

Source

pub fn dyn_type() -> CelValue

Source

pub fn ident_type() -> CelValue

Source

pub fn type_type() -> CelValue

Source

pub fn timestamp_type() -> CelValue

Source

pub fn duration_type() -> CelValue

Source

pub fn bytecode_type() -> CelValue

Source

pub fn err_type() -> CelValue

Source

pub fn message_type(desc: &MessageDescriptor) -> CelValue

Source

pub fn enum_type(desc: &EnumDescriptor) -> CelValue

Source

pub fn is_null(&self) -> bool

Source

pub fn neq(self, rhs: CelValue) -> CelValue

Source

pub fn ord(self, rhs_value: CelValue) -> CelResult<Option<Ordering>>

Source

pub fn lt(self, rhs: CelValue) -> CelValue

Source

pub fn gt(self, rhs: CelValue) -> CelValue

Source

pub fn le(self, rhs: CelValue) -> CelValue

Source

pub fn ge(self, rhs: CelValue) -> CelValue

Source

pub fn or(&self, rhs: &CelValue) -> CelValue

Source

pub fn in_(self, rhs: CelValue) -> CelValue

Source

pub fn and(self, rhs: CelValue) -> CelValue

Source

pub fn index(self, ival: CelValue) -> CelValue

Trait Implementations§

Source§

impl Add for CelValue

Source§

type Output = CelValue

The resulting type after applying the + operator.
Source§

fn add(self, rhs_val: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl CelValueDyn for CelValue

Source§

fn as_type(&self) -> CelValue

Source§

fn access(&self, key: &str) -> CelValue

Source§

fn eq(&self, rhs_val: &CelValue) -> CelValue

Source§

fn is_truthy(&self) -> bool

Source§

fn any_ref<'a>(&'a self) -> &'a dyn Any

Source§

impl Clone for CelValue

Source§

fn clone(&self) -> CelValue

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CelValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CelValue

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for CelValue

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Div for CelValue

Source§

type Output = CelValue

The resulting type after applying the / operator.
Source§

fn div(self, rhs_val: Self) -> Self::Output

Performs the / operation. Read more
Source§

impl From<&[CelValue]> for CelValue

Source§

fn from(val: &[CelValue]) -> CelValue

Converts to this type from the input type.
Source§

impl From<&[u8]> for CelValue

Source§

fn from(val: &[u8]) -> CelValue

Converts to this type from the input type.
Source§

impl From<&Value> for CelValue

Source§

fn from(value: &Value) -> CelValue

Converts to this type from the input type.
Source§

impl From<&str> for CelValue

Source§

fn from(val: &str) -> CelValue

Converts to this type from the input type.
Source§

impl From<CelError> for CelValue

Source§

fn from(value: CelError) -> Self

Converts to this type from the input type.
Source§

impl From<DateTime<FixedOffset>> for CelValue

Source§

fn from(val: DateTime<FixedOffset>) -> CelValue

Converts to this type from the input type.
Source§

impl From<DateTime<Utc>> for CelValue

Source§

fn from(val: DateTime<Utc>) -> CelValue

Converts to this type from the input type.
Source§

impl From<HashMap<String, CelValue>> for CelValue

Source§

fn from(val: HashMap<String, CelValue>) -> CelValue

Converts to this type from the input type.
Source§

impl<'a> From<ReflectValueRef<'a>> for CelValue

Available on crate feature protobuf only.
Source§

fn from(value: ReflectValueRef<'_>) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<CelValue>> From<Result<T, CelError>> for CelValue

Source§

fn from(value: CelResult<T>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for CelValue

Source§

fn from(val: String) -> CelValue

Converts to this type from the input type.
Source§

impl From<TimeDelta> for CelValue

Source§

fn from(val: Duration) -> CelValue

Converts to this type from the input type.
Source§

impl From<Value> for CelValue

Source§

fn from(value: Value) -> CelValue

Converts to this type from the input type.
Source§

impl From<Vec<ByteCode>> for CelValue

Source§

fn from(val: Vec<ByteCode>) -> CelValue

Converts to this type from the input type.
Source§

impl<T: Into<CelValue>> From<Vec<T>> for CelValue

Source§

fn from(value: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for CelValue

Source§

fn from(val: bool) -> CelValue

Converts to this type from the input type.
Source§

impl From<f64> for CelValue

Source§

fn from(val: f64) -> CelValue

Converts to this type from the input type.
Source§

impl From<i16> for CelValue

Source§

fn from(val: i16) -> CelValue

Converts to this type from the input type.
Source§

impl From<i32> for CelValue

Source§

fn from(val: i32) -> CelValue

Converts to this type from the input type.
Source§

impl From<i64> for CelValue

Source§

fn from(val: i64) -> CelValue

Converts to this type from the input type.
Source§

impl From<i8> for CelValue

Source§

fn from(val: i8) -> CelValue

Converts to this type from the input type.
Source§

impl From<u16> for CelValue

Source§

fn from(val: u16) -> CelValue

Converts to this type from the input type.
Source§

impl From<u32> for CelValue

Source§

fn from(val: u32) -> CelValue

Converts to this type from the input type.
Source§

impl From<u64> for CelValue

Source§

fn from(val: u64) -> CelValue

Converts to this type from the input type.
Source§

impl From<u8> for CelValue

Source§

fn from(val: u8) -> CelValue

Converts to this type from the input type.
Source§

impl Mul for CelValue

Source§

type Output = CelValue

The resulting type after applying the * operator.
Source§

fn mul(self, rhs_val: Self) -> Self::Output

Performs the * operation. Read more
Source§

impl Neg for CelValue

Source§

type Output = CelValue

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl Not for CelValue

Source§

type Output = CelValue

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq for CelValue

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Rem for CelValue

Source§

type Output = CelValue

The resulting type after applying the % operator.
Source§

fn rem(self, rhs_val: Self) -> Self::Output

Performs the % operation. Read more
Source§

impl Serialize for CelValue

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Sub for CelValue

Source§

type Output = CelValue

The resulting type after applying the - operator.
Source§

fn sub(self, rhs_val: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl TryInto<DateTime<Utc>> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<DateTime<Utc>>

Performs the conversion.
Source§

impl TryInto<HashMap<String, CelValue>> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<HashMap<String, CelValue>>

Performs the conversion.
Source§

impl TryInto<String> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<String>

Performs the conversion.
Source§

impl TryInto<TimeDelta> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<Duration>

Performs the conversion.
Source§

impl TryInto<Vec<ByteCode>> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<Vec<ByteCode>>

Performs the conversion.
Source§

impl TryInto<Vec<CelValue>> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<Vec<CelValue>>

Performs the conversion.
Source§

impl TryInto<bool> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<bool>

Performs the conversion.
Source§

impl TryInto<f64> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<f64>

Performs the conversion.
Source§

impl TryInto<i64> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<i64>

Performs the conversion.
Source§

impl TryInto<u64> for CelValue

Source§

type Error = CelError

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> CelResult<u64>

Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,