wasmer_wasm_interface/
interface_matcher.rs1use serde::{Deserialize, Serialize};
2use std::collections::{HashMap, HashSet};
3
4use crate::interface::{Export, Import};
5
6#[derive(Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize)]
12pub struct InterfaceMatcher {
13 pub namespaces: HashSet<String>,
14 pub namespace_imports: HashMap<String, HashSet<Import>>,
15 pub exports: HashSet<Export>,
16}
17
18#[cfg(feature = "binary_encode")]
19impl InterfaceMatcher {
20 fn into_bytes(&self) -> Vec<u8> {
22 bincode::serialize(self).expect("Could not serialize InterfaceMatcher")
23 }
24
25 fn from_bytes(bytes: &[u8]) -> Option<Self> {
27 bincode::deserialize(bytes).ok()
28 }
29}