wasmtime_types

Trait TypeTrace

Source
pub trait TypeTrace {
    // Required methods
    fn trace<F, E>(&self, func: &mut F) -> Result<(), E>
       where F: FnMut(EngineOrModuleTypeIndex) -> Result<(), E>;
    fn trace_mut<F, E>(&mut self, func: &mut F) -> Result<(), E>
       where F: FnMut(&mut EngineOrModuleTypeIndex) -> Result<(), E>;

    // Provided methods
    fn trace_engine_indices<F, E>(&self, func: &mut F) -> Result<(), E>
       where F: FnMut(VMSharedTypeIndex) -> Result<(), E> { ... }
    fn canonicalize_for_runtime_usage<F>(&mut self, module_to_engine: &mut F)
       where F: FnMut(ModuleInternedTypeIndex) -> VMSharedTypeIndex { ... }
    fn is_canonicalized_for_runtime_usage(&self) -> bool { ... }
    fn canonicalize_for_hash_consing<F>(
        &mut self,
        rec_group_range: Range<ModuleInternedTypeIndex>,
        module_to_engine: &mut F,
    )
       where F: FnMut(ModuleInternedTypeIndex) -> VMSharedTypeIndex { ... }
    fn is_canonicalized_for_hash_consing(&self) -> bool { ... }
}
Expand description

A trait for things that can trace all type-to-type edges, aka all type indices within this thing.

Required Methods§

Source

fn trace<F, E>(&self, func: &mut F) -> Result<(), E>

Visit each edge.

The function can break out of tracing by returning Err(E).

Source

fn trace_mut<F, E>(&mut self, func: &mut F) -> Result<(), E>
where F: FnMut(&mut EngineOrModuleTypeIndex) -> Result<(), E>,

Visit each edge, mutably.

Allows updating edges.

The function can break out of tracing by returning Err(E).

Provided Methods§

Source

fn trace_engine_indices<F, E>(&self, func: &mut F) -> Result<(), E>
where F: FnMut(VMSharedTypeIndex) -> Result<(), E>,

Trace all VMSharedTypeIndex edges, ignoring other edges.

Source

fn canonicalize_for_runtime_usage<F>(&mut self, module_to_engine: &mut F)

Canonicalize self by rewriting all type references inside self from module-level interned type indices to engine-level interned type indices.

This produces types that are suitable for usage by the runtime (only contains VMSharedTypeIndex type references).

This does not produce types that are suitable for hash consing types (must have recgroup-relative indices for type indices referencing other types in the same recgroup).

Source

fn is_canonicalized_for_runtime_usage(&self) -> bool

Is this type canonicalized for runtime usage?

Source

fn canonicalize_for_hash_consing<F>( &mut self, rec_group_range: Range<ModuleInternedTypeIndex>, module_to_engine: &mut F, )

Canonicalize self by rewriting all type references inside self from module-level interned type indices to either engine-level interned type indices or recgroup-relative indices.

This produces types that are suitable for hash consing and deduplicating recgroups (types may have recgroup-relative indices for references to other types within the same recgroup).

This does not produce types that are suitable for usage by the runtime (only contain VMSharedTypeIndex type references).

Source

fn is_canonicalized_for_hash_consing(&self) -> bool

Is this type canonicalized for hash consing?

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§