Skip to main content

ScriptResolver

Trait ScriptResolver 

Source
pub trait ScriptResolver {
    // Required method
    fn resolve_script_bytes(
        &self,
        script_name: &str,
        res_type: ResType,
    ) -> Result<Option<Vec<u8>>, SourceError>;

    // Provided method
    fn resolve_script(
        &self,
        script_name: &str,
        res_type: ResType,
    ) -> Result<Option<String>, SourceError> { ... }
}
Expand description

Loads script source text by logical name and resource type.

Required Methods§

Source

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

Returns the source bytes for script_name, or None when it does not exist.

§Errors

Returns SourceError if the underlying resource lookup fails.

Provided Methods§

Source

fn resolve_script( &self, script_name: &str, res_type: ResType, ) -> Result<Option<String>, SourceError>

Returns the source contents for script_name, or None when it does not exist.

§Errors

Returns SourceError if the underlying resource lookup or UTF-8 decoding fails.

Implementors§