protobuf/reflect/
type_dynamic.rsuse std::marker;
use crate::reflect::runtime_types::RuntimeTypeTrait;
use crate::reflect::types::ProtobufTypeTrait;
use crate::reflect::ProtobufValue;
use crate::reflect::RuntimeType;
use crate::wire_format::WireType;
pub trait ProtobufTypeDynamic: Send + Sync + 'static {
fn wire_type(&self) -> WireType;
fn runtime_type(&self) -> RuntimeType;
}
pub(crate) struct ProtobufTypeDynamicImpl<T: ProtobufTypeTrait>(pub marker::PhantomData<T>);
impl<T> ProtobufTypeDynamic for ProtobufTypeDynamicImpl<T>
where
T: ProtobufTypeTrait,
<T as ProtobufTypeTrait>::ProtobufValue: ProtobufValue,
{
fn wire_type(&self) -> WireType {
T::WIRE_TYPE
}
fn runtime_type(&self) -> RuntimeType {
<T::ProtobufValue as ProtobufValue>::RuntimeType::runtime_type_box()
}
}