(deserializer: D)
| 474 | #[cfg(feature = "serde")] |
| 475 | impl<'de> serde::Deserialize<'de> for Severity { |
| 476 | fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> |
| 477 | where |
| 478 | D: serde::Deserializer<'de>, |
| 479 | { |
| 480 | let info = OwnedSeverityInfo::deserialize(deserializer)?; |
| 481 | |
| 482 | for severity in Self::variants() { |
| 483 | if severity.code() == info.code { |
| 484 | return Ok(*severity); |
| 485 | } |
| 486 | } |
| 487 | |
| 488 | Err(serde::de::Error::custom("invalid severity code")) |
| 489 | } |
| 490 | } |
| 491 | |
| 492 | impl Display for Severity { |
nothing calls this directly
no test coverage detected