…lines 1–9 unchanged (9 lines)
10use crate::AsMut;
11use crate::AsView;
12use crate::IntoMut;
13use crate::IntoView;
14use crate::__internal::runtime::{KernelMessage, KernelMessageMut, KernelMessageView};
15use crate::__internal::SealedInternal;
16use crate::{MutProxied, ProtoBytes, ProtoString};
17use create::Parse;
18use interop::{MessageMutInterop, MessageViewInterop, OwnedMessageInterop};
19use read::Serialize;
20use std::fmt::Debug;
21use write::{Clear, ClearAndParse, CopyFrom, MergeFrom, TakeFrom};
22
…lines 23–85 unchanged (63 lines)
86 + KernelMessageMut
87{
88 /// The owned message type that this is a mut of.
89 type Message: Message;
90}
91
92/// This trait allows us to associate a tag with each type of protobuf entity. The tag indicates
93/// whether the entity is a message, enum, primitive, view proxy, or mut proxy. The main purpose of
94/// this is to allow us to have separate blanket implementations of various traits for messages
95/// and enums.
96pub trait EntityType {
97 type Tag;
98}
99
100pub mod entity_tag {
101 pub struct MessageTag;
102 pub struct EnumTag;
103 pub struct PrimitiveTag;
104 pub struct ViewProxyTag;
105 pub struct MutProxyTag;
106}
107
108macro_rules! impl_entity_type_for_primitives {
109 ($($t:ty,)*) => {
110 $(
111 impl EntityType for $t {
112 type Tag = entity_tag::PrimitiveTag;
113 }
114 )*
115 };
116}
117
118impl_entity_type_for_primitives!(f32, f64, i32, u32, i64, u64, bool, ProtoBytes, ProtoString,);
119
120/// Operations related to constructing a message. Only owned messages implement
121/// these traits.
122pub(crate) mod create {
123 use super::SealedInternal;
124 pub trait Parse: SealedInternal + Sized {
…lines 125–339 unchanged (215 lines)