Struct golem_wasm_ast::component::Component
source · pub struct Component<Ast: AstCustomization + 'static> { /* private fields */ }
Expand description
The top level node of the Component Model AST
Implementations§
source§impl<Ast> Component<Ast>where
Ast: AstCustomization,
Ast::Expr: TryFromExprSource,
Ast::Data: From<Data<Ast::Expr>>,
Ast::Custom: From<Custom>,
impl<Ast> Component<Ast>where
Ast: AstCustomization,
Ast::Expr: TryFromExprSource,
Ast::Data: From<Data<Ast::Expr>>,
Ast::Custom: From<Custom>,
sourcepub fn from_bytes(bytes: &[u8]) -> Result<Self, String>
pub fn from_bytes(bytes: &[u8]) -> Result<Self, String>
Parses a Component Model AST from the binary WASM byte array
source§impl<Ast> Component<Ast>where
Ast: AstCustomization,
Ast::Expr: RetainsInstructions,
Ast::Data: Into<Data<Ast::Expr>>,
Ast::Custom: Into<Custom>,
impl<Ast> Component<Ast>where
Ast: AstCustomization,
Ast::Expr: RetainsInstructions,
Ast::Data: Into<Data<Ast::Expr>>,
Ast::Custom: Into<Custom>,
source§impl<Ast: AstCustomization> Component<Ast>
impl<Ast: AstCustomization> Component<Ast>
sourcepub fn imports(&self) -> Vec<Mrc<ComponentImport>>
pub fn imports(&self) -> Vec<Mrc<ComponentImport>>
Gets all the imports defined in this component
sourcepub fn exports(&self) -> Vec<Mrc<ComponentExport>>
pub fn exports(&self) -> Vec<Mrc<ComponentExport>>
Gets all the exports defined in this component
sourcepub fn core_instances(&self) -> Vec<Mrc<Instance>>
pub fn core_instances(&self) -> Vec<Mrc<Instance>>
Gets all the core instances defined in this component
sourcepub fn instances(&self) -> Vec<Mrc<ComponentInstance>>
pub fn instances(&self) -> Vec<Mrc<ComponentInstance>>
Gets all the component instances defined in this component
sourcepub fn component_types(&self) -> Vec<Mrc<ComponentType>>
pub fn component_types(&self) -> Vec<Mrc<ComponentType>>
Gets all the component types defined in this component
sourcepub fn core_types(&self) -> Vec<Mrc<CoreType>>
pub fn core_types(&self) -> Vec<Mrc<CoreType>>
Gets all the core types defined in this component
sourcepub fn canons(&self) -> Vec<Mrc<Canon>>
pub fn canons(&self) -> Vec<Mrc<Canon>>
Gets all the canonical function definitions of this component
sourcepub fn components(&self) -> Vec<Mrc<Component<Ast>>>
pub fn components(&self) -> Vec<Mrc<Component<Ast>>>
Gets all the inner components defined in this component
sourcepub fn modules(&self) -> Vec<Mrc<Module<Ast>>>
pub fn modules(&self) -> Vec<Mrc<Module<Ast>>>
Gets all the inner core modules defined in this component
sourcepub fn customs(&self) -> Vec<Mrc<Ast::Custom>>
pub fn customs(&self) -> Vec<Mrc<Ast::Custom>>
Gets all the custom sections defined in this component
sourcepub fn get_core_instance(
&self,
core_instance_idx: CoreInstanceIdx,
) -> Option<Mrc<Instance>>
pub fn get_core_instance( &self, core_instance_idx: CoreInstanceIdx, ) -> Option<Mrc<Instance>>
Returns the core instance referenced by the given index.
sourcepub fn get_instance_wrapped(
&self,
instance_idx: InstanceIdx,
) -> Option<Mrc<ComponentSection<Ast>>>
pub fn get_instance_wrapped( &self, instance_idx: InstanceIdx, ) -> Option<Mrc<ComponentSection<Ast>>>
Returns the component instance referenced by the given index.
sourcepub fn get_instance(
&self,
instance_idx: InstanceIdx,
) -> Option<Mrc<ComponentInstance>>
pub fn get_instance( &self, instance_idx: InstanceIdx, ) -> Option<Mrc<ComponentInstance>>
Returns the component instance referenced by the given index.
sourcepub fn get_component_type(
&self,
component_type_idx: ComponentTypeIdx,
) -> Option<Mrc<ComponentSection<Ast>>>
pub fn get_component_type( &self, component_type_idx: ComponentTypeIdx, ) -> Option<Mrc<ComponentSection<Ast>>>
Returns the component type referenced by the given index.
It can be one of the following section types:
- ComponentType
- Alias
- ComponentExport
- ComponentImport
sourcepub fn get_core_func(
&self,
core_func_idx: FuncIdx,
) -> Option<Mrc<ComponentSection<Ast>>>
pub fn get_core_func( &self, core_func_idx: FuncIdx, ) -> Option<Mrc<ComponentSection<Ast>>>
Returns the core function referenced by the given index.
It can be one of the following section types:
- Canon
- Alias
sourcepub fn get_component(
&self,
component_idx: ComponentIdx,
) -> Option<Mrc<ComponentSection<Ast>>>
pub fn get_component( &self, component_idx: ComponentIdx, ) -> Option<Mrc<ComponentSection<Ast>>>
Returns the component referenced by the given index.
It can be one of the following section types:
- Component
- Alias
- ComponentExport
- ComponentImport
sourcepub fn get_component_func(
&self,
component_func_idx: ComponentFuncIdx,
) -> Option<Mrc<ComponentSection<Ast>>>
pub fn get_component_func( &self, component_func_idx: ComponentFuncIdx, ) -> Option<Mrc<ComponentSection<Ast>>>
Returns the component function referenced by the given index.
It can be one of the following section types:
- Canon
- Alias
- ComponentExport
- ComponentImport
sourcepub fn get_value(
&self,
value_idx: ValueIdx,
) -> Option<Mrc<ComponentSection<Ast>>>
pub fn get_value( &self, value_idx: ValueIdx, ) -> Option<Mrc<ComponentSection<Ast>>>
Returns the value referenced by the given index.
It can be one of the following section types:
- Alias
- ComponentExport
- ComponentImport
sourcepub fn get_module(
&self,
module_idx: ModuleIdx,
) -> Option<Mrc<ComponentSection<Ast>>>
pub fn get_module( &self, module_idx: ModuleIdx, ) -> Option<Mrc<ComponentSection<Ast>>>
Returns the module referenced by the given index.
It can be one of the following section types:
- Module
- Alias
- ComponentExport
- ComponentImport
sourcepub fn into_sections(self) -> Vec<Mrc<ComponentSection<Ast>>>
pub fn into_sections(self) -> Vec<Mrc<ComponentSection<Ast>>>
Converts this component into a sequence of component sections.
sourcepub fn into_grouped(
self,
) -> Vec<(ComponentSectionType, Vec<Mrc<ComponentSection<Ast>>>)>
pub fn into_grouped( self, ) -> Vec<(ComponentSectionType, Vec<Mrc<ComponentSection<Ast>>>)>
Converts this component into a sequence of grouped component sections, exactly as it would be in the binary WASM format.
Trait Implementations§
source§impl<Ast: AstCustomization> Clone for Component<Ast>
impl<Ast: AstCustomization> Clone for Component<Ast>
source§impl<Ast: AstCustomization> Debug for Component<Ast>
impl<Ast: AstCustomization> Debug for Component<Ast>
source§impl<Ast: AstCustomization> PartialEq for Component<Ast>
impl<Ast: AstCustomization> PartialEq for Component<Ast>
source§impl<Ast: AstCustomization> Section<ComponentIndexSpace, ComponentSectionType> for Component<Ast>
impl<Ast: AstCustomization> Section<ComponentIndexSpace, ComponentSectionType> for Component<Ast>
fn index_space(&self) -> ComponentIndexSpace
fn section_type(&self) -> ComponentSectionType
Auto Trait Implementations§
impl<Ast> !Freeze for Component<Ast>
impl<Ast> !RefUnwindSafe for Component<Ast>
impl<Ast> !Send for Component<Ast>
impl<Ast> !Sync for Component<Ast>
impl<Ast> Unpin for Component<Ast>
impl<Ast> !UnwindSafe for Component<Ast>
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)