MCPcopy Create free account
hub / github.com/RustCrypto/utils / visit_map

Method visit_map

zlint/src/lib.rs:62–97  ·  view source on GitHub ↗
(self, mut access: M)

Source from the content-addressed store, hash-verified

60 }
61
62 fn visit_map<M>(self, mut access: M) -> Result<Self::Value, M::Error>
63 where
64 M: MapAccess<'de>,
65 {
66 let mut status_output = None;
67 let mut details = None;
68
69 while let Some((key, value)) = access.next_entry::<&str, &str>()? {
70 if key == "result" {
71 status_output = Some(match value {
72 "NA" => Status::NotApplicable,
73 "NE" => Status::NotEffective,
74 "pass" => Status::Pass,
75 "notice" => Status::Notice,
76 "fatal" => Status::Fatal,
77 "error" => Status::Error,
78 "warn" => Status::Warn,
79 "info" => Status::Info,
80 other => {
81 return Err(M::Error::custom(format!(
82 "unsupported value: {other}",
83 )));
84 }
85 });
86 }
87 if key == "details" {
88 details = Some(value.to_string());
89 }
90 }
91
92 if let Some(status) = status_output {
93 Ok(LintStatus { status, details })
94 } else {
95 Err(M::Error::custom("no 'result' field found"))
96 }
97 }
98 }
99
100 deserializer.deserialize_map(StatusVisitor)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected