protobuf/reflect/value/
mod.rs
1use std::fmt;
2
3#[cfg(feature = "bytes")]
4use ::bytes::Bytes;
5
6#[cfg(feature = "bytes")]
7use crate::chars::Chars;
8use crate::reflect::runtime_types::RuntimeTypeBool;
9use crate::reflect::runtime_types::RuntimeTypeF32;
10use crate::reflect::runtime_types::RuntimeTypeF64;
11use crate::reflect::runtime_types::RuntimeTypeI32;
12use crate::reflect::runtime_types::RuntimeTypeI64;
13use crate::reflect::runtime_types::RuntimeTypeString;
14#[cfg(feature = "bytes")]
15use crate::reflect::runtime_types::RuntimeTypeTokioBytes;
16#[cfg(feature = "bytes")]
17use crate::reflect::runtime_types::RuntimeTypeTokioChars;
18use crate::reflect::runtime_types::RuntimeTypeTrait;
19use crate::reflect::runtime_types::RuntimeTypeU32;
20use crate::reflect::runtime_types::RuntimeTypeU64;
21use crate::reflect::runtime_types::RuntimeTypeVecU8;
22
23pub(crate) mod value_box;
24pub(crate) mod value_ref;
25
26pub trait ProtobufValue: Clone + Default + fmt::Debug + Send + Sync + Sized + 'static {
31 type RuntimeType: RuntimeTypeTrait<Value = Self>;
33}
34
35impl ProtobufValue for u32 {
36 type RuntimeType = RuntimeTypeU32;
37}
38
39impl ProtobufValue for u64 {
40 type RuntimeType = RuntimeTypeU64;
41}
42
43impl ProtobufValue for i32 {
44 type RuntimeType = RuntimeTypeI32;
45}
46
47impl ProtobufValue for i64 {
48 type RuntimeType = RuntimeTypeI64;
49}
50
51impl ProtobufValue for f32 {
52 type RuntimeType = RuntimeTypeF32;
53}
54
55impl ProtobufValue for f64 {
56 type RuntimeType = RuntimeTypeF64;
57}
58
59impl ProtobufValue for bool {
60 type RuntimeType = RuntimeTypeBool;
61}
62
63impl ProtobufValue for String {
64 type RuntimeType = RuntimeTypeString;
65}
66
67impl ProtobufValue for Vec<u8> {
68 type RuntimeType = RuntimeTypeVecU8;
69}
70
71#[cfg(feature = "bytes")]
72impl ProtobufValue for Bytes {
73 type RuntimeType = RuntimeTypeTokioBytes;
74}
75
76#[cfg(feature = "bytes")]
77impl ProtobufValue for Chars {
78 type RuntimeType = RuntimeTypeTokioChars;
79}
80
81