1pub mod protocol;
8
9pub use gproxy_protocol_macros::{WireBuilder, wire};
10pub use protocol::*;
11
12#[derive(Debug, Clone, PartialEq, Eq)]
15#[non_exhaustive]
16pub struct WireBuildError {
17 type_name: &'static str,
18 field: &'static str,
19}
20
21impl WireBuildError {
22 #[doc(hidden)]
23 pub const fn missing(type_name: &'static str, field: &'static str) -> Self {
24 Self { type_name, field }
25 }
26
27 pub const fn type_name(&self) -> &'static str {
28 self.type_name
29 }
30
31 pub const fn field(&self) -> &'static str {
32 self.field
33 }
34}
35
36impl std::fmt::Display for WireBuildError {
37 fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
38 write!(
39 formatter,
40 "missing required field `{}.{}`",
41 self.type_name, self.field
42 )
43 }
44}
45
46impl std::error::Error for WireBuildError {}