google_protobuf/
shared.rs1#![deny(unsafe_op_in_unsafe_fn)]
9
10use std::fmt;
11
12#[doc(inline)]
18pub use crate::__internal::runtime::message_eq;
19
20pub use crate::__internal::runtime::interop::*;
21#[cfg(not(lite_runtime))]
22pub use crate::codegen_traits::WithReflection;
23pub use crate::codegen_traits::{
24 create::Parse,
25 read::Serialize,
26 write::{Clear, ClearAndParse, CopyFrom, MergeFrom, TakeFrom},
27 Message, MessageMut, MessageType, MessageView,
28};
29pub use crate::cord::{ProtoBytesCow, ProtoStringCow};
30pub use crate::extension::ExtensionId;
31pub use crate::map::{Map, MapIter, MapKey, MapMut, MapValue, MapView};
32
33pub use crate::proxied::{
34 AsMut, AsView, IntoMut, IntoProxied, IntoView, Mut, MutProtoObject, ProtoObject, View,
35};
36#[allow(deprecated)]
37pub use crate::proxied::{MutProxied, Proxied};
38pub use crate::r#enum::{Enum, UnknownEnumValue};
39pub use crate::repeated::{Repeated, RepeatedIter, RepeatedMut, RepeatedView};
40pub use crate::singular::Singular;
41pub use crate::string::{ProtoBytes, ProtoStr, ProtoString, Utf8Error};
42pub use protobuf_macros::proto_proc as proto;
43
44pub use Singular as ProxiedInRepeated;
46
47pub mod prelude;
48
49#[path = "internal.rs"]
65pub mod __internal;
66
67mod codegen_traits;
68mod cord;
69#[path = "enum.rs"]
70mod r#enum;
71mod extension;
72mod map;
73mod primitive;
74mod proxied;
75mod repeated;
76mod singular;
77mod string;
78
79#[cfg(not(bzl))]
80#[path = "upb/lib.rs"]
81mod upb;
82
83#[unsafe(no_mangle)]
86unsafe extern "C" fn __Disallow_Upb_And_Cpp_In_Same_Binary() {}
87
88#[derive(Debug, Clone)]
90pub struct ParseError;
91
92impl std::error::Error for ParseError {}
93
94impl fmt::Display for ParseError {
95 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
96 write!(f, "Couldn't deserialize given bytes into a proto")
97 }
98}
99
100#[derive(Debug, Clone)]
102pub struct SerializeError;
103
104impl std::error::Error for SerializeError {}
105
106impl fmt::Display for SerializeError {
107 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
108 write!(f, "Couldn't serialize proto into bytes (depth too deep or missing required fields)")
109 }
110}