MCPcopy Create free account
hub / github.com/aws/aws-lambda-rust-runtime / visit_map

Method visit_map

lambda-events/src/event/cloudwatch_logs/mod.rs:104–130  ·  view source on GitHub ↗
(self, mut map: V)

Source from the content-addressed store, hash-verified

102 }
103
104 fn visit_map<V>(self, mut map: V) -> Result<AwsLogs, V::Error>
105 where
106 V: MapAccess<'de>,
107 {
108 use base64::Engine;
109
110 let mut data = None;
111 while let Some(key) = map.next_key()? {
112 match key {
113 "data" => {
114 let bytes = map.next_value::<String>().and_then(|string| {
115 base64::engine::general_purpose::STANDARD
116 .decode(string)
117 .map_err(Error::custom)
118 })?;
119
120 let bytes = flate2::read::GzDecoder::new(&bytes[..]);
121 let mut de = serde_json::Deserializer::from_reader(BufReader::new(bytes));
122 data = Some(LogData::deserialize(&mut de).map_err(Error::custom)?);
123 }
124 _ => return Err(Error::unknown_field(key, FIELDS)),
125 }
126 }
127
128 let data = data.ok_or_else(|| Error::missing_field("data"))?;
129 Ok(AwsLogs { data })
130 }
131 }
132
133 const FIELDS: &[&str] = &["data"];

Callers

nothing calls this directly

Calls 2

from_readerFunction · 0.85
deserializeFunction · 0.50

Tested by

no test coverage detected