pub trait MessageValue:
Debug
+ Send
+ Sync {
// Required methods
fn type_name(&self) -> &str;
fn eq_message(&self, other: &dyn MessageValue) -> bool;
fn as_any(&self) -> &dyn Any;
fn clone_boxed(&self) -> Box<dyn MessageValue>;
// Provided method
fn is_default(&self) -> Option<bool> { ... }
}Expand description
A trait representing a protobuf message value at runtime.
This abstraction allows cel-core to work with proto messages without depending on a specific protobuf library (e.g., prost-reflect).
§Object Safety
This trait is object-safe and can be used with dyn MessageValue.
§Downcasting
The as_any() method enables downcasting to concrete types. Note that
downcasting only works with the exact concrete type - wrapped or newtype
implementations will not match. Equality comparisons via eq_message()
will return false for different concrete types even if they represent
the same message content.
§Map Keys
MessageValue does not support hashing, so proto messages cannot be used
as map keys in CEL. This matches the CEL specification.
Required Methods§
Sourcefn eq_message(&self, other: &dyn MessageValue) -> bool
fn eq_message(&self, other: &dyn MessageValue) -> bool
Check equality with another message value.
Sourcefn clone_boxed(&self) -> Box<dyn MessageValue>
fn clone_boxed(&self) -> Box<dyn MessageValue>
Clone this message value into a boxed trait object.
Provided Methods§
Sourcefn is_default(&self) -> Option<bool>
fn is_default(&self) -> Option<bool>
Returns true if this message is a “zero value” (all fields are default/unset).
Used by optionals extension for hasValue() / or() semantics.
Returns None if the implementation cannot determine default status.