1#![allow(rustdoc::redundant_explicit_links)]
18#![allow(rustdoc::broken_intra_doc_links)]
19#![no_implicit_prelude]
20extern crate bytes;
21extern crate serde;
22extern crate serde_json;
23extern crate serde_with;
24extern crate std;
25extern crate wkt;
26
27#[derive(Clone, Default, PartialEq)]
31#[non_exhaustive]
32pub struct HttpRequest {
33 pub request_method: std::string::String,
35
36 pub request_url: std::string::String,
40
41 pub request_size: i64,
44
45 pub status: i32,
48
49 pub response_size: i64,
52
53 pub user_agent: std::string::String,
57
58 pub remote_ip: std::string::String,
62
63 pub server_ip: std::string::String,
67
68 pub referer: std::string::String,
72
73 pub latency: std::option::Option<wkt::Duration>,
76
77 pub cache_lookup: bool,
79
80 pub cache_hit: bool,
83
84 pub cache_validated_with_origin_server: bool,
88
89 pub cache_fill_bytes: i64,
92
93 pub protocol: std::string::String,
95
96 _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
97}
98
99impl HttpRequest {
100 pub fn new() -> Self {
101 std::default::Default::default()
102 }
103
104 pub fn set_request_method<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
106 self.request_method = v.into();
107 self
108 }
109
110 pub fn set_request_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
112 self.request_url = v.into();
113 self
114 }
115
116 pub fn set_request_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
118 self.request_size = v.into();
119 self
120 }
121
122 pub fn set_status<T: std::convert::Into<i32>>(mut self, v: T) -> Self {
124 self.status = v.into();
125 self
126 }
127
128 pub fn set_response_size<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
130 self.response_size = v.into();
131 self
132 }
133
134 pub fn set_user_agent<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
136 self.user_agent = v.into();
137 self
138 }
139
140 pub fn set_remote_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
142 self.remote_ip = v.into();
143 self
144 }
145
146 pub fn set_server_ip<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
148 self.server_ip = v.into();
149 self
150 }
151
152 pub fn set_referer<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
154 self.referer = v.into();
155 self
156 }
157
158 pub fn set_latency<T>(mut self, v: T) -> Self
160 where
161 T: std::convert::Into<wkt::Duration>,
162 {
163 self.latency = std::option::Option::Some(v.into());
164 self
165 }
166
167 pub fn set_or_clear_latency<T>(mut self, v: std::option::Option<T>) -> Self
169 where
170 T: std::convert::Into<wkt::Duration>,
171 {
172 self.latency = v.map(|x| x.into());
173 self
174 }
175
176 pub fn set_cache_lookup<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
178 self.cache_lookup = v.into();
179 self
180 }
181
182 pub fn set_cache_hit<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
184 self.cache_hit = v.into();
185 self
186 }
187
188 pub fn set_cache_validated_with_origin_server<T: std::convert::Into<bool>>(
190 mut self,
191 v: T,
192 ) -> Self {
193 self.cache_validated_with_origin_server = v.into();
194 self
195 }
196
197 pub fn set_cache_fill_bytes<T: std::convert::Into<i64>>(mut self, v: T) -> Self {
199 self.cache_fill_bytes = v.into();
200 self
201 }
202
203 pub fn set_protocol<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
205 self.protocol = v.into();
206 self
207 }
208}
209
210impl wkt::message::Message for HttpRequest {
211 fn typename() -> &'static str {
212 "type.googleapis.com/google.logging.type.HttpRequest"
213 }
214}
215
216#[doc(hidden)]
217impl<'de> serde::de::Deserialize<'de> for HttpRequest {
218 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
219 where
220 D: serde::Deserializer<'de>,
221 {
222 #[allow(non_camel_case_types)]
223 #[doc(hidden)]
224 #[derive(PartialEq, Eq, Hash)]
225 enum __FieldTag {
226 __request_method,
227 __request_url,
228 __request_size,
229 __status,
230 __response_size,
231 __user_agent,
232 __remote_ip,
233 __server_ip,
234 __referer,
235 __latency,
236 __cache_lookup,
237 __cache_hit,
238 __cache_validated_with_origin_server,
239 __cache_fill_bytes,
240 __protocol,
241 Unknown(std::string::String),
242 }
243 impl<'de> serde::de::Deserialize<'de> for __FieldTag {
244 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
245 where
246 D: serde::Deserializer<'de>,
247 {
248 struct Visitor;
249 impl<'de> serde::de::Visitor<'de> for Visitor {
250 type Value = __FieldTag;
251 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
252 formatter.write_str("a field name for HttpRequest")
253 }
254 fn visit_str<E>(self, value: &str) -> std::result::Result<Self::Value, E>
255 where
256 E: serde::de::Error,
257 {
258 use std::result::Result::Ok;
259 use std::string::ToString;
260 match value {
261 "requestMethod" => Ok(__FieldTag::__request_method),
262 "request_method" => Ok(__FieldTag::__request_method),
263 "requestUrl" => Ok(__FieldTag::__request_url),
264 "request_url" => Ok(__FieldTag::__request_url),
265 "requestSize" => Ok(__FieldTag::__request_size),
266 "request_size" => Ok(__FieldTag::__request_size),
267 "status" => Ok(__FieldTag::__status),
268 "responseSize" => Ok(__FieldTag::__response_size),
269 "response_size" => Ok(__FieldTag::__response_size),
270 "userAgent" => Ok(__FieldTag::__user_agent),
271 "user_agent" => Ok(__FieldTag::__user_agent),
272 "remoteIp" => Ok(__FieldTag::__remote_ip),
273 "remote_ip" => Ok(__FieldTag::__remote_ip),
274 "serverIp" => Ok(__FieldTag::__server_ip),
275 "server_ip" => Ok(__FieldTag::__server_ip),
276 "referer" => Ok(__FieldTag::__referer),
277 "latency" => Ok(__FieldTag::__latency),
278 "cacheLookup" => Ok(__FieldTag::__cache_lookup),
279 "cache_lookup" => Ok(__FieldTag::__cache_lookup),
280 "cacheHit" => Ok(__FieldTag::__cache_hit),
281 "cache_hit" => Ok(__FieldTag::__cache_hit),
282 "cacheValidatedWithOriginServer" => {
283 Ok(__FieldTag::__cache_validated_with_origin_server)
284 }
285 "cache_validated_with_origin_server" => {
286 Ok(__FieldTag::__cache_validated_with_origin_server)
287 }
288 "cacheFillBytes" => Ok(__FieldTag::__cache_fill_bytes),
289 "cache_fill_bytes" => Ok(__FieldTag::__cache_fill_bytes),
290 "protocol" => Ok(__FieldTag::__protocol),
291 _ => Ok(__FieldTag::Unknown(value.to_string())),
292 }
293 }
294 }
295 deserializer.deserialize_identifier(Visitor)
296 }
297 }
298 struct Visitor;
299 impl<'de> serde::de::Visitor<'de> for Visitor {
300 type Value = HttpRequest;
301 fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
302 formatter.write_str("struct HttpRequest")
303 }
304 fn visit_map<A>(self, mut map: A) -> std::result::Result<Self::Value, A::Error>
305 where
306 A: serde::de::MapAccess<'de>,
307 {
308 #[allow(unused_imports)]
309 use serde::de::Error;
310 use std::option::Option::Some;
311 let mut fields = std::collections::HashSet::new();
312 let mut result = Self::Value::new();
313 while let Some(tag) = map.next_key::<__FieldTag>()? {
314 #[allow(clippy::match_single_binding)]
315 match tag {
316 __FieldTag::__request_method => {
317 if !fields.insert(__FieldTag::__request_method) {
318 return std::result::Result::Err(A::Error::duplicate_field(
319 "multiple values for request_method",
320 ));
321 }
322 result.request_method = map
323 .next_value::<std::option::Option<std::string::String>>()?
324 .unwrap_or_default();
325 }
326 __FieldTag::__request_url => {
327 if !fields.insert(__FieldTag::__request_url) {
328 return std::result::Result::Err(A::Error::duplicate_field(
329 "multiple values for request_url",
330 ));
331 }
332 result.request_url = map
333 .next_value::<std::option::Option<std::string::String>>()?
334 .unwrap_or_default();
335 }
336 __FieldTag::__request_size => {
337 if !fields.insert(__FieldTag::__request_size) {
338 return std::result::Result::Err(A::Error::duplicate_field(
339 "multiple values for request_size",
340 ));
341 }
342 struct __With(std::option::Option<i64>);
343 impl<'de> serde::de::Deserialize<'de> for __With {
344 fn deserialize<D>(
345 deserializer: D,
346 ) -> std::result::Result<Self, D::Error>
347 where
348 D: serde::de::Deserializer<'de>,
349 {
350 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
351 }
352 }
353 result.request_size = map.next_value::<__With>()?.0.unwrap_or_default();
354 }
355 __FieldTag::__status => {
356 if !fields.insert(__FieldTag::__status) {
357 return std::result::Result::Err(A::Error::duplicate_field(
358 "multiple values for status",
359 ));
360 }
361 struct __With(std::option::Option<i32>);
362 impl<'de> serde::de::Deserialize<'de> for __With {
363 fn deserialize<D>(
364 deserializer: D,
365 ) -> std::result::Result<Self, D::Error>
366 where
367 D: serde::de::Deserializer<'de>,
368 {
369 serde_with::As::< std::option::Option<wkt::internal::I32> >::deserialize(deserializer).map(__With)
370 }
371 }
372 result.status = map.next_value::<__With>()?.0.unwrap_or_default();
373 }
374 __FieldTag::__response_size => {
375 if !fields.insert(__FieldTag::__response_size) {
376 return std::result::Result::Err(A::Error::duplicate_field(
377 "multiple values for response_size",
378 ));
379 }
380 struct __With(std::option::Option<i64>);
381 impl<'de> serde::de::Deserialize<'de> for __With {
382 fn deserialize<D>(
383 deserializer: D,
384 ) -> std::result::Result<Self, D::Error>
385 where
386 D: serde::de::Deserializer<'de>,
387 {
388 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
389 }
390 }
391 result.response_size =
392 map.next_value::<__With>()?.0.unwrap_or_default();
393 }
394 __FieldTag::__user_agent => {
395 if !fields.insert(__FieldTag::__user_agent) {
396 return std::result::Result::Err(A::Error::duplicate_field(
397 "multiple values for user_agent",
398 ));
399 }
400 result.user_agent = map
401 .next_value::<std::option::Option<std::string::String>>()?
402 .unwrap_or_default();
403 }
404 __FieldTag::__remote_ip => {
405 if !fields.insert(__FieldTag::__remote_ip) {
406 return std::result::Result::Err(A::Error::duplicate_field(
407 "multiple values for remote_ip",
408 ));
409 }
410 result.remote_ip = map
411 .next_value::<std::option::Option<std::string::String>>()?
412 .unwrap_or_default();
413 }
414 __FieldTag::__server_ip => {
415 if !fields.insert(__FieldTag::__server_ip) {
416 return std::result::Result::Err(A::Error::duplicate_field(
417 "multiple values for server_ip",
418 ));
419 }
420 result.server_ip = map
421 .next_value::<std::option::Option<std::string::String>>()?
422 .unwrap_or_default();
423 }
424 __FieldTag::__referer => {
425 if !fields.insert(__FieldTag::__referer) {
426 return std::result::Result::Err(A::Error::duplicate_field(
427 "multiple values for referer",
428 ));
429 }
430 result.referer = map
431 .next_value::<std::option::Option<std::string::String>>()?
432 .unwrap_or_default();
433 }
434 __FieldTag::__latency => {
435 if !fields.insert(__FieldTag::__latency) {
436 return std::result::Result::Err(A::Error::duplicate_field(
437 "multiple values for latency",
438 ));
439 }
440 result.latency =
441 map.next_value::<std::option::Option<wkt::Duration>>()?;
442 }
443 __FieldTag::__cache_lookup => {
444 if !fields.insert(__FieldTag::__cache_lookup) {
445 return std::result::Result::Err(A::Error::duplicate_field(
446 "multiple values for cache_lookup",
447 ));
448 }
449 result.cache_lookup = map
450 .next_value::<std::option::Option<bool>>()?
451 .unwrap_or_default();
452 }
453 __FieldTag::__cache_hit => {
454 if !fields.insert(__FieldTag::__cache_hit) {
455 return std::result::Result::Err(A::Error::duplicate_field(
456 "multiple values for cache_hit",
457 ));
458 }
459 result.cache_hit = map
460 .next_value::<std::option::Option<bool>>()?
461 .unwrap_or_default();
462 }
463 __FieldTag::__cache_validated_with_origin_server => {
464 if !fields.insert(__FieldTag::__cache_validated_with_origin_server) {
465 return std::result::Result::Err(A::Error::duplicate_field(
466 "multiple values for cache_validated_with_origin_server",
467 ));
468 }
469 result.cache_validated_with_origin_server = map
470 .next_value::<std::option::Option<bool>>()?
471 .unwrap_or_default();
472 }
473 __FieldTag::__cache_fill_bytes => {
474 if !fields.insert(__FieldTag::__cache_fill_bytes) {
475 return std::result::Result::Err(A::Error::duplicate_field(
476 "multiple values for cache_fill_bytes",
477 ));
478 }
479 struct __With(std::option::Option<i64>);
480 impl<'de> serde::de::Deserialize<'de> for __With {
481 fn deserialize<D>(
482 deserializer: D,
483 ) -> std::result::Result<Self, D::Error>
484 where
485 D: serde::de::Deserializer<'de>,
486 {
487 serde_with::As::< std::option::Option<wkt::internal::I64> >::deserialize(deserializer).map(__With)
488 }
489 }
490 result.cache_fill_bytes =
491 map.next_value::<__With>()?.0.unwrap_or_default();
492 }
493 __FieldTag::__protocol => {
494 if !fields.insert(__FieldTag::__protocol) {
495 return std::result::Result::Err(A::Error::duplicate_field(
496 "multiple values for protocol",
497 ));
498 }
499 result.protocol = map
500 .next_value::<std::option::Option<std::string::String>>()?
501 .unwrap_or_default();
502 }
503 __FieldTag::Unknown(key) => {
504 let value = map.next_value::<serde_json::Value>()?;
505 result._unknown_fields.insert(key, value);
506 }
507 }
508 }
509 std::result::Result::Ok(result)
510 }
511 }
512 deserializer.deserialize_any(Visitor)
513 }
514}
515
516#[doc(hidden)]
517impl serde::ser::Serialize for HttpRequest {
518 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
519 where
520 S: serde::ser::Serializer,
521 {
522 use serde::ser::SerializeMap;
523 #[allow(unused_imports)]
524 use std::option::Option::Some;
525 let mut state = serializer.serialize_map(std::option::Option::None)?;
526 if !self.request_method.is_empty() {
527 state.serialize_entry("requestMethod", &self.request_method)?;
528 }
529 if !self.request_url.is_empty() {
530 state.serialize_entry("requestUrl", &self.request_url)?;
531 }
532 if !wkt::internal::is_default(&self.request_size) {
533 struct __With<'a>(&'a i64);
534 impl<'a> serde::ser::Serialize for __With<'a> {
535 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
536 where
537 S: serde::ser::Serializer,
538 {
539 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
540 }
541 }
542 state.serialize_entry("requestSize", &__With(&self.request_size))?;
543 }
544 if !wkt::internal::is_default(&self.status) {
545 struct __With<'a>(&'a i32);
546 impl<'a> serde::ser::Serialize for __With<'a> {
547 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
548 where
549 S: serde::ser::Serializer,
550 {
551 serde_with::As::<wkt::internal::I32>::serialize(self.0, serializer)
552 }
553 }
554 state.serialize_entry("status", &__With(&self.status))?;
555 }
556 if !wkt::internal::is_default(&self.response_size) {
557 struct __With<'a>(&'a i64);
558 impl<'a> serde::ser::Serialize for __With<'a> {
559 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
560 where
561 S: serde::ser::Serializer,
562 {
563 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
564 }
565 }
566 state.serialize_entry("responseSize", &__With(&self.response_size))?;
567 }
568 if !self.user_agent.is_empty() {
569 state.serialize_entry("userAgent", &self.user_agent)?;
570 }
571 if !self.remote_ip.is_empty() {
572 state.serialize_entry("remoteIp", &self.remote_ip)?;
573 }
574 if !self.server_ip.is_empty() {
575 state.serialize_entry("serverIp", &self.server_ip)?;
576 }
577 if !self.referer.is_empty() {
578 state.serialize_entry("referer", &self.referer)?;
579 }
580 if self.latency.is_some() {
581 state.serialize_entry("latency", &self.latency)?;
582 }
583 if !wkt::internal::is_default(&self.cache_lookup) {
584 state.serialize_entry("cacheLookup", &self.cache_lookup)?;
585 }
586 if !wkt::internal::is_default(&self.cache_hit) {
587 state.serialize_entry("cacheHit", &self.cache_hit)?;
588 }
589 if !wkt::internal::is_default(&self.cache_validated_with_origin_server) {
590 state.serialize_entry(
591 "cacheValidatedWithOriginServer",
592 &self.cache_validated_with_origin_server,
593 )?;
594 }
595 if !wkt::internal::is_default(&self.cache_fill_bytes) {
596 struct __With<'a>(&'a i64);
597 impl<'a> serde::ser::Serialize for __With<'a> {
598 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
599 where
600 S: serde::ser::Serializer,
601 {
602 serde_with::As::<wkt::internal::I64>::serialize(self.0, serializer)
603 }
604 }
605 state.serialize_entry("cacheFillBytes", &__With(&self.cache_fill_bytes))?;
606 }
607 if !self.protocol.is_empty() {
608 state.serialize_entry("protocol", &self.protocol)?;
609 }
610 if !self._unknown_fields.is_empty() {
611 for (key, value) in self._unknown_fields.iter() {
612 state.serialize_entry(key, &value)?;
613 }
614 }
615 state.end()
616 }
617}
618
619impl std::fmt::Debug for HttpRequest {
620 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
621 let mut debug_struct = f.debug_struct("HttpRequest");
622 debug_struct.field("request_method", &self.request_method);
623 debug_struct.field("request_url", &self.request_url);
624 debug_struct.field("request_size", &self.request_size);
625 debug_struct.field("status", &self.status);
626 debug_struct.field("response_size", &self.response_size);
627 debug_struct.field("user_agent", &self.user_agent);
628 debug_struct.field("remote_ip", &self.remote_ip);
629 debug_struct.field("server_ip", &self.server_ip);
630 debug_struct.field("referer", &self.referer);
631 debug_struct.field("latency", &self.latency);
632 debug_struct.field("cache_lookup", &self.cache_lookup);
633 debug_struct.field("cache_hit", &self.cache_hit);
634 debug_struct.field(
635 "cache_validated_with_origin_server",
636 &self.cache_validated_with_origin_server,
637 );
638 debug_struct.field("cache_fill_bytes", &self.cache_fill_bytes);
639 debug_struct.field("protocol", &self.protocol);
640 if !self._unknown_fields.is_empty() {
641 debug_struct.field("_unknown_fields", &self._unknown_fields);
642 }
643 debug_struct.finish()
644 }
645}
646
647#[derive(Clone, Debug, PartialEq)]
679#[non_exhaustive]
680pub enum LogSeverity {
681 Default,
683 Debug,
685 Info,
687 Notice,
690 Warning,
692 Error,
694 Critical,
696 Alert,
698 Emergency,
700 UnknownValue(log_severity::UnknownValue),
705}
706
707#[doc(hidden)]
708pub mod log_severity {
709 #[allow(unused_imports)]
710 use super::*;
711 #[derive(Clone, Debug, PartialEq)]
712 pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
713}
714
715impl LogSeverity {
716 pub fn value(&self) -> std::option::Option<i32> {
721 match self {
722 Self::Default => std::option::Option::Some(0),
723 Self::Debug => std::option::Option::Some(100),
724 Self::Info => std::option::Option::Some(200),
725 Self::Notice => std::option::Option::Some(300),
726 Self::Warning => std::option::Option::Some(400),
727 Self::Error => std::option::Option::Some(500),
728 Self::Critical => std::option::Option::Some(600),
729 Self::Alert => std::option::Option::Some(700),
730 Self::Emergency => std::option::Option::Some(800),
731 Self::UnknownValue(u) => u.0.value(),
732 }
733 }
734
735 pub fn name(&self) -> std::option::Option<&str> {
740 match self {
741 Self::Default => std::option::Option::Some("DEFAULT"),
742 Self::Debug => std::option::Option::Some("DEBUG"),
743 Self::Info => std::option::Option::Some("INFO"),
744 Self::Notice => std::option::Option::Some("NOTICE"),
745 Self::Warning => std::option::Option::Some("WARNING"),
746 Self::Error => std::option::Option::Some("ERROR"),
747 Self::Critical => std::option::Option::Some("CRITICAL"),
748 Self::Alert => std::option::Option::Some("ALERT"),
749 Self::Emergency => std::option::Option::Some("EMERGENCY"),
750 Self::UnknownValue(u) => u.0.name(),
751 }
752 }
753}
754
755impl std::default::Default for LogSeverity {
756 fn default() -> Self {
757 use std::convert::From;
758 Self::from(0)
759 }
760}
761
762impl std::fmt::Display for LogSeverity {
763 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
764 wkt::internal::display_enum(f, self.name(), self.value())
765 }
766}
767
768impl std::convert::From<i32> for LogSeverity {
769 fn from(value: i32) -> Self {
770 match value {
771 0 => Self::Default,
772 100 => Self::Debug,
773 200 => Self::Info,
774 300 => Self::Notice,
775 400 => Self::Warning,
776 500 => Self::Error,
777 600 => Self::Critical,
778 700 => Self::Alert,
779 800 => Self::Emergency,
780 _ => Self::UnknownValue(log_severity::UnknownValue(
781 wkt::internal::UnknownEnumValue::Integer(value),
782 )),
783 }
784 }
785}
786
787impl std::convert::From<&str> for LogSeverity {
788 fn from(value: &str) -> Self {
789 use std::string::ToString;
790 match value {
791 "DEFAULT" => Self::Default,
792 "DEBUG" => Self::Debug,
793 "INFO" => Self::Info,
794 "NOTICE" => Self::Notice,
795 "WARNING" => Self::Warning,
796 "ERROR" => Self::Error,
797 "CRITICAL" => Self::Critical,
798 "ALERT" => Self::Alert,
799 "EMERGENCY" => Self::Emergency,
800 _ => Self::UnknownValue(log_severity::UnknownValue(
801 wkt::internal::UnknownEnumValue::String(value.to_string()),
802 )),
803 }
804 }
805}
806
807impl serde::ser::Serialize for LogSeverity {
808 fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
809 where
810 S: serde::Serializer,
811 {
812 match self {
813 Self::Default => serializer.serialize_i32(0),
814 Self::Debug => serializer.serialize_i32(100),
815 Self::Info => serializer.serialize_i32(200),
816 Self::Notice => serializer.serialize_i32(300),
817 Self::Warning => serializer.serialize_i32(400),
818 Self::Error => serializer.serialize_i32(500),
819 Self::Critical => serializer.serialize_i32(600),
820 Self::Alert => serializer.serialize_i32(700),
821 Self::Emergency => serializer.serialize_i32(800),
822 Self::UnknownValue(u) => u.0.serialize(serializer),
823 }
824 }
825}
826
827impl<'de> serde::de::Deserialize<'de> for LogSeverity {
828 fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
829 where
830 D: serde::Deserializer<'de>,
831 {
832 deserializer.deserialize_any(wkt::internal::EnumVisitor::<LogSeverity>::new(
833 ".google.logging.type.LogSeverity",
834 ))
835 }
836}