in src/fixups/buildscript.rs [223:255]
fn visit_map<M>(self, mut access: M) -> Result<Self::Value, M::Error>
where
M: MapAccess<'de>,
{
let res = if let Some(key) = access.next_key::<&str>()? {
let res = match key {
"unresolved" => BuildscriptFixup::Unresolved(access.next_value()?),
"rustc_flags" => BuildscriptFixup::RustcFlags(access.next_value()?),
"gen_srcs" => BuildscriptFixup::GenSrcs(access.next_value()?),
"cxx_library" => BuildscriptFixup::CxxLibrary(access.next_value()?),
"prebuilt_cxx_library" => {
BuildscriptFixup::PrebuiltCxxLibrary(access.next_value()?)
}
other => {
// other keys are unit, which map to an empty map
let _ = access.next_value::<Empty>()?;
self.visit_str(other)?
}
};
Ok(res)
} else {
return Err(M::Error::custom("Empty BuildscriptFixup map"));
};
if let Some(key) = access.next_key::<&str>()? {
Err(M::Error::custom(format!(
"Extra BuildscriptFixup map entry: {}",
key
)))
} else {
res
}
}