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§
Sourcefn resolve_script_bytes(
&self,
script_name: &str,
res_type: ResType,
) -> Result<Option<Vec<u8>>, SourceError>
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§
Sourcefn resolve_script(
&self,
script_name: &str,
res_type: ResType,
) -> Result<Option<String>, SourceError>
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.