MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / visit_map

Method visit_map

cranelift/module/src/module.rs:630–678  ·  view source on GitHub ↗
(self, mut map: A)

Source from the content-addressed store, hash-verified

628
629 #[inline]
630 fn visit_map<A: MapAccess<'de>>(self, mut map: A) -> Result<Self::Value, A::Error> {
631 let mut _version_marker: Option<VersionMarker> = None;
632 let mut functions: Option<PrimaryMap<FuncId, FunctionDeclaration>> = None;
633 let mut data_objects: Option<PrimaryMap<DataId, DataDeclaration>> = None;
634 while let Some(key) = map.next_key::<ModuleDeclarationsField>()? {
635 match key {
636 ModuleDeclarationsField::VersionMarker => {
637 if _version_marker.is_some() {
638 return Err(Error::duplicate_field("_version_marker"));
639 }
640 _version_marker = Some(map.next_value()?);
641 }
642 ModuleDeclarationsField::Functions => {
643 if functions.is_some() {
644 return Err(Error::duplicate_field("functions"));
645 }
646 functions = Some(map.next_value()?);
647 }
648 ModuleDeclarationsField::DataObjects => {
649 if data_objects.is_some() {
650 return Err(Error::duplicate_field("data_objects"));
651 }
652 data_objects = Some(map.next_value()?);
653 }
654 _ => {
655 map.next_value::<serde::de::IgnoredAny>()?;
656 }
657 }
658 }
659 let _version_marker = match _version_marker {
660 Some(_version_marker) => _version_marker,
661 None => return Err(Error::missing_field("_version_marker")),
662 };
663 let functions = match functions {
664 Some(functions) => functions,
665 None => return Err(Error::missing_field("functions")),
666 };
667 let data_objects = match data_objects {
668 Some(data_objects) => data_objects,
669 None => return Err(Error::missing_field("data_objects")),
670 };
671 let names = get_names(&functions, &data_objects)?;
672 Ok(ModuleDeclarations {
673 _version_marker,
674 names,
675 functions,
676 data_objects,
677 })
678 }
679 }
680
681 impl<'de> Deserialize<'de> for ModuleDeclarations {

Callers

nothing calls this directly

Calls 3

get_namesFunction · 0.85
OkFunction · 0.85
is_someMethod · 0.45

Tested by

no test coverage detected