Skip to main content

CompilerHost

Trait CompilerHost 

Source
pub trait CompilerHost {
    // Required methods
    fn resolve_script_bytes(
        &self,
        script_name: &str,
        res_type: ResType,
    ) -> Result<Option<Vec<u8>>, SourceError>;
    fn write_file(
        &mut self,
        file_name: &str,
        res_type: ResType,
        data: &[u8],
        binary: bool,
    ) -> Result<(), CompilerHostError>;

    // Provided method
    fn write_graphviz(
        &mut self,
        _file_name: &str,
        _dot: &str,
    ) -> Result<(), CompilerHostError> { ... }
}
Expand description

One callback-driven host for loading NWScript source and receiving compiler outputs.

Required Methods§

Source

fn resolve_script_bytes( &self, script_name: &str, res_type: ResType, ) -> Result<Option<Vec<u8>>, SourceError>

Resolves one logical script name for the requested resource type.

§Errors

Returns SourceError if the underlying lookup fails.

Source

fn write_file( &mut self, file_name: &str, res_type: ResType, data: &[u8], binary: bool, ) -> Result<(), CompilerHostError>

Receives one emitted compiler artifact.

§Errors

Returns CompilerHostError if the host cannot persist or accept the output.

Provided Methods§

Source

fn write_graphviz( &mut self, _file_name: &str, _dot: &str, ) -> Result<(), CompilerHostError>

Receives one Graphviz DOT file when graphviz output is requested.

§Errors

Returns CompilerHostError if the host cannot persist or accept the output.

Implementors§