pub struct RenderOptions {
pub wd: PathBuf,
pub variables: HashMap<String, String>,
pub shell_commands: bool,
}
Fields§
§wd: PathBuf
Working Directory for the Shell Commands
variables: HashMap<String, String>
Variables to use for the template
shell_commands: bool
Run Shell Commands for the output or not
Implementations§
Source§impl RenderOptions
impl RenderOptions
pub fn render(&self, templ: &Template) -> Result<String, Error>
Sourcepub fn render_iter<'a>(&'a self, templ: &'a Template) -> RenderIter<'a> ⓘ
pub fn render_iter<'a>(&'a self, templ: &'a Template) -> RenderIter<'a> ⓘ
Makes a [RenderIter<'a>
] that can generate incremented strings from the given Template
and the RenderOptions
. The Iterator will have -N
appended where N is the number representing the number of instance.
let templ = Template::parse_template("hello {name}").unwrap();
let mut vars: HashMap<String, String> = HashMap::new();
vars.insert("name".into(), "world".into());
let options = RenderOptions {
variables: vars,
..Default::default()
};
let mut names = options.render_iter(&templ);
assert_eq!("hello world-1", names.next().unwrap());
assert_eq!("hello world-2", names.next().unwrap());
assert_eq!("hello world-3", names.next().unwrap());
Trait Implementations§
Source§impl Clone for RenderOptions
impl Clone for RenderOptions
Source§fn clone(&self) -> RenderOptions
fn clone(&self) -> RenderOptions
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for RenderOptions
impl Debug for RenderOptions
Source§impl Default for RenderOptions
impl Default for RenderOptions
Source§fn default() -> RenderOptions
fn default() -> RenderOptions
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RenderOptions
impl RefUnwindSafe for RenderOptions
impl Send for RenderOptions
impl Sync for RenderOptions
impl Unpin for RenderOptions
impl UnwindSafe for RenderOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more