Trait cryogen_prelude::CompileVariablePlugin
[−]
[src]
pub trait CompileVariablePlugin { type RenderValue: Serialize; fn plugin_name() -> &'static str; fn arg_full_name() -> &'static str; fn arg_help() -> &'static str; fn additional_args() -> Vec<Arg<'static, 'static>>; fn from_args<'a>(args: &'a ArgMatches<'a>) -> Self; fn read_file(&self, file: File) -> Result<Self::RenderValue, String>; fn read_path<P: AsRef<Path>>(
&self,
path: P
) -> Result<Self::RenderValue, String> { ... } }
A plugin that can assign a value to a variable in the Tera context from a file.
Associated Types
type RenderValue: Serialize
The serializable value to add to the Tera context.
Required Methods
fn plugin_name() -> &'static str
The name of the plugin.
fn arg_full_name() -> &'static str
The name of the argument that provides the variable name to file mapping.
fn arg_help() -> &'static str
The help string to display.
fn additional_args() -> Vec<Arg<'static, 'static>>
Optional arguments to supply. These should be prefixed to avoid namespace clashes.
fn from_args<'a>(args: &'a ArgMatches<'a>) -> Self
Constructor for building the plugin from the supplied command line arguments.
fn read_file(&self, file: File) -> Result<Self::RenderValue, String>
Reads and parses the supplied file. The result is stored in the Tera context.
Provided Methods
fn read_path<P: AsRef<Path>>(
&self,
path: P
) -> Result<Self::RenderValue, String>
&self,
path: P
) -> Result<Self::RenderValue, String>
Reads and parses a file at a specific path.