pub enum ComponentItemSpec {
ComponentFunc {
params: Vec<(String, String)>,
results: Vec<String>,
},
CoreFunc(String),
Module(String),
Component {
imports: HashMap<String, ComponentItemSpec>,
exports: HashMap<String, ComponentItemSpec>,
},
ComponentInstance {
exports: HashMap<String, ComponentItemSpec>,
},
Type(String),
Resource(String),
Unknown {
debug: Option<String>,
},
}Expand description
A serializable and inspectable representation of a WebAssembly Component Model item.
This enum captures the structure of component imports and exports in a way that can be
serialized to TOML/JSON, displayed in CLI output, or used for interface validation.
It abstracts over low-level wasmtime::component::types::ComponentItem to provide
a stable, human-readable format.
Note: This representation is intentionally lossy for MVP. Full WIT type fidelity
will be added in later versions using wit-parser.
Variants§
ComponentFunc
A WebAssembly component function with named parameters and result types.
Fields
CoreFunc(String)
A core WebAssembly function (not part of the Component Model).
Should generally not appear in valid components, but included for completeness.
Module(String)
A core WebAssembly module embedded within a component.
Represented as a placeholder string in MVP.
Component
A nested WebAssembly component.
Contains its own imports and exports, forming a hierarchical structure.
Fields
imports: HashMap<String, ComponentItemSpec>Imports declared by the nested component.
exports: HashMap<String, ComponentItemSpec>Exports provided by the nested component.
ComponentInstance
An instantiated component (e.g., a resolved instance like wasi:cli/stdio).
Only contains exports, as instances are the result of linking.
Fields
exports: HashMap<String, ComponentItemSpec>The exported items of this instance.
Type(String)
A user-defined type (record, variant, enum, flags, etc.).
Represented as a placeholder string in MVP.
Resource(String)
A resource handle (e.g., file descriptor, socket).
Represented as a placeholder string in MVP.
Unknown
A fallback for unrecognized or unrepresentable component items.
Used to prevent parsing failures when encountering new or malformed items.
Trait Implementations§
Source§impl Clone for ComponentItemSpec
impl Clone for ComponentItemSpec
Source§fn clone(&self) -> ComponentItemSpec
fn clone(&self) -> ComponentItemSpec
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ComponentItemSpec
impl Debug for ComponentItemSpec
Source§impl<'de> Deserialize<'de> for ComponentItemSpec
impl<'de> Deserialize<'de> for ComponentItemSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ComponentItemSpec
impl Display for ComponentItemSpec
Source§impl FromName for ComponentItemSpec
FromName impl for ComponentItemSpec to enable NamedMap dual-format input.
impl FromName for ComponentItemSpec
FromName impl for ComponentItemSpec to enable NamedMap dual-format input.
Source§impl PartialEq for ComponentItemSpec
impl PartialEq for ComponentItemSpec
Source§impl Serialize for ComponentItemSpec
impl Serialize for ComponentItemSpec
impl Eq for ComponentItemSpec
impl StructuralPartialEq for ComponentItemSpec
Auto Trait Implementations§
impl Freeze for ComponentItemSpec
impl RefUnwindSafe for ComponentItemSpec
impl Send for ComponentItemSpec
impl Sync for ComponentItemSpec
impl Unpin for ComponentItemSpec
impl UnwindSafe for ComponentItemSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.