Skip to main content

BaseHost

Trait BaseHost 

Source
pub trait BaseHost {
    // Required method
    fn get_label_and_source_file(
        &self,
        location: &Location,
    ) -> (SourceSpan, Option<Arc<SourceFile>>);

    // Provided method
    fn resolve_event(&self, _event_id: EventId) -> Option<&EventName> { ... }
}
Expand description

Defines the host functionality shared by both sync and async execution.

There are three main categories of interactions between the VM and the host:

  1. getting a library’s MAST forest,
  2. handling VM events (which can mutate the process’ advice provider).

Required Methods§

Source

fn get_label_and_source_file( &self, location: &Location, ) -> (SourceSpan, Option<Arc<SourceFile>>)

Returns the SourceSpan and optional SourceFile for the provided location.

Provided Methods§

Source

fn resolve_event(&self, _event_id: EventId) -> Option<&EventName>

Returns the EventName registered for the provided EventId, if any.

Hosts that maintain an event registry can override this method to surface human-readable names for diagnostics. The default implementation returns None.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§