pub enum Constant {
Null,
Bool(bool),
Int(i64),
Uint(u64),
Double(f64),
Bytes(BytesValue),
String(StringValue),
Duration(Duration),
Timestamp(DateTime<Utc>),
}
Expand description
CEL constant value.
Constant
represents constant values known at compile time, supporting CEL’s basic data types.
Constants can be used for compile-time optimization and type inference.
§Supported Types
Null
: Null valueBool
: Boolean valueInt
: 64-bit signed integerUint
: 64-bit unsigned integerDouble
: 64-bit floating point numberString
: UTF-8 stringBytes
: Byte arrayDuration
: Time durationTimestamp
: Timestamp
§Examples
use cel_cxx::Constant;
let null_const = Constant::Null;
let bool_const = Constant::Bool(true);
let int_const = Constant::Int(42);
let string_const = Constant::String("hello".to_string().into());
Variants§
Null
Null constant
Bool(bool)
Boolean constant
Int(i64)
Signed integer constant
Uint(u64)
Unsigned integer constant
Double(f64)
Floating point constant
Bytes(BytesValue)
Byte array constant
String(StringValue)
String constant
Duration(Duration)
Duration constant
Timestamp(DateTime<Utc>)
Timestamp constant
Implementations§
Trait Implementations§
Source§impl From<ArcSlice<[u8]>> for Constant
impl From<ArcSlice<[u8]>> for Constant
Source§fn from(value: BytesValue) -> Self
fn from(value: BytesValue) -> Self
Converts to this type from the input type.
Source§impl From<ArcSlice<str>> for Constant
impl From<ArcSlice<str>> for Constant
Source§fn from(value: StringValue) -> Self
fn from(value: StringValue) -> Self
Converts to this type from the input type.
Source§impl From<SystemTime> for Constant
impl From<SystemTime> for Constant
Source§fn from(value: SystemTime) -> Self
fn from(value: SystemTime) -> Self
Converts to this type from the input type.
impl StructuralPartialEq for Constant
Auto Trait Implementations§
impl Freeze for Constant
impl RefUnwindSafe for Constant
impl Send for Constant
impl Sync for Constant
impl Unpin for Constant
impl UnwindSafe for Constant
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
Converts
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>
Converts
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