Trait protobuf::reflect::runtime_types::RuntimeType[][src]

pub trait RuntimeType: Debug + Send + Sync + 'static {
    type Value: ProtobufValue + Clone + Sized + Debug + Default;
    fn runtime_type_box() -> RuntimeTypeBox
    where
        Self: Sized
;
fn default_value_ref() -> ReflectValueRef<'static>;
fn from_value_box(
        value_box: ReflectValueBox
    ) -> Result<Self::Value, ReflectValueBox>;
fn into_value_box(value: Self::Value) -> ReflectValueBox;
fn as_ref(value: &Self::Value) -> ReflectValueRef<'_>;
fn as_mut(value: &mut Self::Value) -> ReflectValueMut<'_>;
fn is_non_zero(value: &Self::Value) -> bool; fn into_static_value_ref(value: Self::Value) -> ReflectValueRef<'static> { ... }
fn set_from_value_box(target: &mut Self::Value, value_box: ReflectValueBox) { ... } }
Expand description

RuntimeType is not implemented by all protobuf types directly because it’s not possible to implement RuntimeType for all Message implementations at once: each Message implementation has to reimplement all the methods again. With current strategy there’s only implementation for all messages, which is RuntimeTypeMessage.

The downside is that we have to explicitly specify type parameters in a lot of places.

Associated Types

Actual value for this type.

Required methods

“Box” version of type type.

Default value for this type.

Construct a value from given reflective value.

Panics

If reflective value is of incompatible type.

Convert a value into a refletive box value.

Pointer to a dynamic reference.

Mutable pointer to a dynamic mutable reference.

Value is non-default?

Provided methods

Convert a value into a ref value if possible.

Panics

For message and enum.

Write the value.

Implementors