Skip to main content

ProtoTypeResolver

Trait ProtoTypeResolver 

Source
pub trait ProtoTypeResolver:
    Debug
    + Send
    + Sync {
    // Required methods
    fn get_field_type(&self, message: &str, field: &str) -> Option<CelType>;
    fn has_message(&self, message: &str) -> bool;
    fn is_extension(&self, message: &str, ext_name: &str) -> bool;
    fn get_enum_value(&self, enum_name: &str, value_name: &str) -> Option<i32>;
    fn resolve_qualified(
        &self,
        parts: &[&str],
        container: &str,
    ) -> Option<ResolvedProtoType>;
    fn resolve_message_name(
        &self,
        name: &str,
        container: &str,
    ) -> Option<String>;
    fn as_any(&self) -> &dyn Any;

    // Provided method
    fn message_field_names(&self, _message: &str) -> Option<Vec<String>> { ... }
}
Expand description

Trait for protobuf descriptor pool access (checker operations).

This trait provides type information needed during type checking, without requiring the ability to construct or manipulate proto messages.

§Object Safety

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

§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.

Required Methods§

Source

fn get_field_type(&self, message: &str, field: &str) -> Option<CelType>

Get the CEL type of a message field.

Source

fn has_message(&self, message: &str) -> bool

Check whether a message type is known to this registry.

Source

fn is_extension(&self, message: &str, ext_name: &str) -> bool

Check whether ext_name is a known extension field on message.

Source

fn get_enum_value(&self, enum_name: &str, value_name: &str) -> Option<i32>

Get the numeric value of an enum constant by name.

Source

fn resolve_qualified( &self, parts: &[&str], container: &str, ) -> Option<ResolvedProtoType>

Resolve a qualified name (dot-separated parts) within a container namespace.

Returns the resolved proto type (Message, Enum, or EnumValue).

Source

fn resolve_message_name(&self, name: &str, container: &str) -> Option<String>

Resolve a message name within a container namespace using C++ namespace rules.

Returns the fully qualified message name if found.

Source

fn as_any(&self) -> &dyn Any

Downcast to a concrete type via Any.

Provided Methods§

Source

fn message_field_names(&self, _message: &str) -> Option<Vec<String>>

List all field names of a message type.

Returns None if the message type is unknown to this registry. Default implementation returns None.

Implementors§