pub struct TemplateContext { /* private fields */ }Expand description
Global context shared across all template functions
This struct is thread-safe and can be cloned cheaply (uses Arc internally)
Implementations§
Source§impl TemplateContext
impl TemplateContext
Sourcepub fn new(base_dir: PathBuf, trust_mode: bool) -> Self
pub fn new(base_dir: PathBuf, trust_mode: bool) -> Self
Create a new context with the given base directory and trust mode
Sourcepub fn from_template_file(template_path: &str, trust_mode: bool) -> Result<Self>
pub fn from_template_file(template_path: &str, trust_mode: bool) -> Result<Self>
Create context from a template file path
The base directory will be the directory containing the template file
Sourcepub fn from_stdin(trust_mode: bool) -> Result<Self>
pub fn from_stdin(trust_mode: bool) -> Result<Self>
Create context for stdin (uses current working directory)
Sourcepub fn is_trust_mode(&self) -> bool
pub fn is_trust_mode(&self) -> bool
Check if trust mode is enabled
Trait Implementations§
Source§impl Clone for TemplateContext
impl Clone for TemplateContext
Source§fn clone(&self) -> TemplateContext
fn clone(&self) -> TemplateContext
Returns a duplicate 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 moreAuto Trait Implementations§
impl Freeze for TemplateContext
impl RefUnwindSafe for TemplateContext
impl Send for TemplateContext
impl Sync for TemplateContext
impl Unpin for TemplateContext
impl UnwindSafe for TemplateContext
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