sui_rpc/proto/
google.rs

1pub mod protobuf {
2    /// Byte encoded FILE_DESCRIPTOR_SET.
3    pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/google.protobuf.fds.bin");
4
5    #[cfg(test)]
6    mod tests {
7        use super::FILE_DESCRIPTOR_SET;
8        use prost::Message as _;
9
10        #[test]
11        fn file_descriptor_set_is_valid() {
12            prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET).unwrap();
13        }
14    }
15}
16
17pub mod rpc {
18    include!("generated/google.rpc.rs");
19
20    /// Byte encoded FILE_DESCRIPTOR_SET.
21    pub const FILE_DESCRIPTOR_SET: &[u8] = include_bytes!("generated/google.rpc.fds.bin");
22
23    // Include generated serde impls
24    include!("generated/google.rpc.serde.rs");
25
26    include!("generated/google.rpc.accessors.rs");
27
28    impl ::prost::Name for Status {
29        const NAME: &'static str = "Status";
30        const PACKAGE: &'static str = "google.rpc";
31        fn full_name() -> ::prost::alloc::string::String {
32            "google.rpc.Status".into()
33        }
34        fn type_url() -> ::prost::alloc::string::String {
35            "/google.rpc.Status".into()
36        }
37    }
38
39    impl ::prost::Name for ErrorInfo {
40        const NAME: &'static str = "ErrorInfo";
41        const PACKAGE: &'static str = "google.rpc";
42        fn full_name() -> ::prost::alloc::string::String {
43            "google.rpc.ErrorInfo".into()
44        }
45        fn type_url() -> ::prost::alloc::string::String {
46            "/google.rpc.ErrorInfo".into()
47        }
48    }
49
50    impl ::prost::Name for RetryInfo {
51        const NAME: &'static str = "RetryInfo";
52        const PACKAGE: &'static str = "google.rpc";
53        fn full_name() -> ::prost::alloc::string::String {
54            "google.rpc.RetryInfo".into()
55        }
56        fn type_url() -> ::prost::alloc::string::String {
57            "/google.rpc.RetryInfo".into()
58        }
59    }
60
61    impl ::prost::Name for DebugInfo {
62        const NAME: &'static str = "DebugInfo";
63        const PACKAGE: &'static str = "google.rpc";
64        fn full_name() -> ::prost::alloc::string::String {
65            "google.rpc.DebugInfo".into()
66        }
67        fn type_url() -> ::prost::alloc::string::String {
68            "/google.rpc.DebugInfo".into()
69        }
70    }
71
72    impl ::prost::Name for QuotaFailure {
73        const NAME: &'static str = "QuotaFailure";
74        const PACKAGE: &'static str = "google.rpc";
75        fn full_name() -> ::prost::alloc::string::String {
76            "google.rpc.QuotaFailure".into()
77        }
78        fn type_url() -> ::prost::alloc::string::String {
79            "/google.rpc.QuotaFailure".into()
80        }
81    }
82
83    impl ::prost::Name for PreconditionFailure {
84        const NAME: &'static str = "PreconditionFailure";
85        const PACKAGE: &'static str = "google.rpc";
86        fn full_name() -> ::prost::alloc::string::String {
87            "google.rpc.PreconditionFailure".into()
88        }
89        fn type_url() -> ::prost::alloc::string::String {
90            "/google.rpc.PreconditionFailure".into()
91        }
92    }
93
94    impl ::prost::Name for BadRequest {
95        const NAME: &'static str = "BadRequest";
96        const PACKAGE: &'static str = "google.rpc";
97        fn full_name() -> ::prost::alloc::string::String {
98            "google.rpc.BadRequest".into()
99        }
100        fn type_url() -> ::prost::alloc::string::String {
101            "/google.rpc.BadRequest".into()
102        }
103    }
104
105    impl bad_request::FieldViolation {
106        pub fn new<T: Into<String>>(field: T) -> Self {
107            Self {
108                field: field.into(),
109                ..Default::default()
110            }
111        }
112
113        pub fn new_at<T: Into<String>>(field: T, index: usize) -> Self {
114            use std::fmt::Write;
115
116            let mut field = field.into();
117            write!(&mut field, "[{index}]").expect("write to String cannot fail");
118
119            Self {
120                field,
121                ..Default::default()
122            }
123        }
124
125        // pub fn with_description<T: Into<String>>(mut self, description: T) -> Self {
126        //     self.description = description.into();
127        //     self
128        // }
129
130        // pub fn with_reason<T: Into<String>>(mut self, reason: T) -> Self {
131        //     self.reason = reason.into();
132        //     self
133        // }
134
135        pub fn nested<T: Into<String>>(mut self, field: T) -> Self {
136            use std::fmt::Write;
137
138            let mut field = field.into();
139
140            if !self.field.is_empty() {
141                write!(
142                    &mut field,
143                    "{}{}",
144                    crate::field::FIELD_SEPARATOR,
145                    self.field
146                )
147                .expect("write to String cannot fail");
148            }
149
150            self.field = field;
151            self
152        }
153
154        pub fn nested_at<T: Into<String>>(mut self, field: T, index: usize) -> Self {
155            use std::fmt::Write;
156
157            let mut field = field.into();
158            write!(&mut field, "[{index}]").expect("write to String cannot fail");
159
160            if !self.field.is_empty() {
161                write!(
162                    &mut field,
163                    "{}{}",
164                    crate::field::FIELD_SEPARATOR,
165                    self.field
166                )
167                .expect("write to String cannot fail");
168            }
169
170            self.field = field;
171            self
172        }
173    }
174
175    impl From<bad_request::FieldViolation> for BadRequest {
176        fn from(value: bad_request::FieldViolation) -> Self {
177            Self {
178                field_violations: vec![value],
179            }
180        }
181    }
182
183    impl BadRequest {
184        pub fn nested<T: AsRef<str>>(mut self, field: T) -> Self {
185            let field = field.as_ref();
186            self.field_violations = self
187                .field_violations
188                .into_iter()
189                .map(|violation| violation.nested(field))
190                .collect();
191            self
192        }
193
194        pub fn nested_at<T: AsRef<str>>(mut self, field: T, index: usize) -> Self {
195            let field = field.as_ref();
196            self.field_violations = self
197                .field_violations
198                .into_iter()
199                .map(|violation| violation.nested_at(field, index))
200                .collect();
201            self
202        }
203    }
204
205    impl ::prost::Name for RequestInfo {
206        const NAME: &'static str = "RequestInfo";
207        const PACKAGE: &'static str = "google.rpc";
208        fn full_name() -> ::prost::alloc::string::String {
209            "google.rpc.RequestInfo".into()
210        }
211        fn type_url() -> ::prost::alloc::string::String {
212            "/google.rpc.RequestInfo".into()
213        }
214    }
215
216    impl ::prost::Name for ResourceInfo {
217        const NAME: &'static str = "ResourceInfo";
218        const PACKAGE: &'static str = "google.rpc";
219        fn full_name() -> ::prost::alloc::string::String {
220            "google.rpc.ResourceInfo".into()
221        }
222        fn type_url() -> ::prost::alloc::string::String {
223            "/google.rpc.ResourceInfo".into()
224        }
225    }
226
227    #[cfg(test)]
228    mod tests {
229        use super::FILE_DESCRIPTOR_SET;
230        use prost::Message as _;
231
232        #[test]
233        fn file_descriptor_set_is_valid() {
234            prost_types::FileDescriptorSet::decode(FILE_DESCRIPTOR_SET).unwrap();
235        }
236    }
237}