Skip to main content

ProtoRegistry

Trait ProtoRegistry 

Source
pub trait ProtoRegistry: ProtoTypeResolver {
    // Required methods
    fn construct_message(
        &self,
        type_name: &str,
        fields: &[StructFieldValue],
        strong_enums: bool,
    ) -> Value;
    fn message_field_access(
        &self,
        msg: &dyn MessageValue,
        field: &str,
        optional: bool,
        strong_enums: bool,
    ) -> Value;
    fn message_has_field(&self, msg: &dyn MessageValue, field: &str) -> Value;
    fn get_extension_value(
        &self,
        msg: &dyn MessageValue,
        ext_name: &str,
        optional: bool,
        strong_enums: bool,
    ) -> Option<Value>;
    fn has_extension(
        &self,
        msg: &dyn MessageValue,
        ext_name: &str,
    ) -> Option<bool>;
}
Expand description

Trait for protobuf runtime operations (evaluator operations).

This trait extends ProtoTypeResolver with the ability to construct messages, access fields at runtime, and work with extensions. It is used by the evaluator.

§Object Safety

This trait is object-safe and can be used with dyn ProtoRegistry.

Required Methods§

Source

fn construct_message( &self, type_name: &str, fields: &[StructFieldValue], strong_enums: bool, ) -> Value

Construct a protobuf message from evaluated field values.

Returns the constructed message as a Value (may be unwrapped to a native CEL value for well-known types like Timestamp, Duration, etc.).

Source

fn message_field_access( &self, msg: &dyn MessageValue, field: &str, optional: bool, strong_enums: bool, ) -> Value

Access a field on a message value.

Returns the field value, or an error/optional-none for missing fields.

Source

fn message_has_field(&self, msg: &dyn MessageValue, field: &str) -> Value

Test whether a message has a field set (for has() macro).

Source

fn get_extension_value( &self, msg: &dyn MessageValue, ext_name: &str, optional: bool, strong_enums: bool, ) -> Option<Value>

Get an extension field value from a message.

Returns None if the extension is not applicable to this message type.

Source

fn has_extension(&self, msg: &dyn MessageValue, ext_name: &str) -> Option<bool>

Test whether a message has an extension field set.

Returns None if the extension is not applicable to this message type.

Implementors§