pub struct VariableDeclOrConstant { /* private fields */ }
Expand description
Union type representing either a variable declaration or constant definition.
VariableDeclOrConstant
can hold either:
- A constant value (
Constant
) that is known at compile time - A variable declaration (
ValueType
) that specifies the type for runtime binding
This allows the registry to handle both compile-time constants and runtime variables in a unified way.
§Examples
use cel_cxx::variable::VariableDeclOrConstant;
use cel_cxx::types::ValueType;
// Create from constant
let constant_entry = VariableDeclOrConstant::new_constant(42i64);
assert!(constant_entry.is_constant());
// Create from declaration
let decl_entry = VariableDeclOrConstant::new(ValueType::String);
assert!(!decl_entry.is_constant());
Implementations§
Source§impl VariableDeclOrConstant
impl VariableDeclOrConstant
Sourcepub fn new_constant<T>(value: T) -> Selfwhere
T: IntoConstant,
pub fn new_constant<T>(value: T) -> Selfwhere
T: IntoConstant,
Creates a new constant entry.
§Type Parameters
T
: The constant type, must implementIntoConstant
§Parameters
value
: The constant value
§Returns
New VariableDeclOrConstant
containing the constant value
Sourcepub fn is_constant(&self) -> bool
pub fn is_constant(&self) -> bool
Returns whether this entry is a constant.
§Returns
true
if this entry contains a constant value, false
if it’s a declaration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VariableDeclOrConstant
impl RefUnwindSafe for VariableDeclOrConstant
impl Send for VariableDeclOrConstant
impl Sync for VariableDeclOrConstant
impl Unpin for VariableDeclOrConstant
impl UnwindSafe for VariableDeclOrConstant
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> 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