Trait CompilableAsContent

Source
pub trait CompilableAsContent {
    // Required method
    fn get_compiled_content(
        &self,
        ctx: &Arc<Mutex<Context>>,
    ) -> Result<PartialContent, Box<dyn Error>>;

    // Provided method
    fn check_dependencies(&self, _ctx: &Arc<Mutex<Context>>) -> Option<String> { ... }
}

Required Methods§

Source

fn get_compiled_content( &self, ctx: &Arc<Mutex<Context>>, ) -> Result<PartialContent, Box<dyn Error>>

Get a compiled PartialContent of self.

Expected to return a content previously stored in the given Context, if possible, or to compile self and return the result. Expected to return error if not all dependencies of self are retrievable from the given Context as a PartialContent.

Note: unlike compile_as_dependency(), this function isn’t expected to store compilation result in the Context.

Provided Methods§

Source

fn check_dependencies(&self, _ctx: &Arc<Mutex<Context>>) -> Option<String>

Check whether all dependencies of self are retrievable from the given Context.

Expected to return None if none of dependencies is missing from Context, or a name of a missing dependency, chosen arbitrarily.

Implementors§