Struct ckb_resource::TemplateContext
source · pub struct TemplateContext<'a> { /* private fields */ }Expand description
The context used to expand the Template.
Implementations§
source§impl<'a> TemplateContext<'a>
impl<'a> TemplateContext<'a>
sourcepub fn new<I>(spec: &'a str, kvs: I) -> Selfwhere
I: IntoIterator<Item = (&'a str, &'a str)>,
pub fn new<I>(spec: &'a str, kvs: I) -> Selfwhere
I: IntoIterator<Item = (&'a str, &'a str)>,
Creates a new template.
spec- the chain spec name for template spec branch.kvs- the initial template variables.
Examples
use ckb_resource::TemplateContext;
// Creates a context for *dev* chain and initializes variables:
//
// rpc_port => 8114
// p2p_port => 8115
TemplateContext::new("dev", vec![("rpc_port", "8114"), ("p2p_port", "8115")]);