pub struct Template {
pub content: String,
}Expand description
Template for rendering prompts with variable substitution.
Fields§
§content: StringImplementations§
Source§impl Template
impl Template
Sourcepub fn render(
&self,
variables: &HashMap<&str, String>,
) -> Result<String, TemplateError>
pub fn render( &self, variables: &HashMap<&str, String>, ) -> Result<String, TemplateError>
Render the template with the provided variables.
Sourcepub fn render_with_partials(
&self,
variables: &HashMap<&str, String>,
partials: &HashMap<String, String>,
) -> Result<String, TemplateError>
pub fn render_with_partials( &self, variables: &HashMap<&str, String>, partials: &HashMap<String, String>, ) -> Result<String, TemplateError>
Render the template with variables and partials support.
Sourcepub fn render_with_log(
&self,
template_name: &str,
variables: &HashMap<&str, String>,
partials: &HashMap<String, String>,
) -> Result<RenderedTemplate, TemplateError>
pub fn render_with_log( &self, template_name: &str, variables: &HashMap<&str, String>, partials: &HashMap<String, String>, ) -> Result<RenderedTemplate, TemplateError>
Render the template with variables and partials, returning substitution log.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Template
impl RefUnwindSafe for Template
impl Send for Template
impl Sync for Template
impl Unpin for Template
impl UnsafeUnpin for Template
impl UnwindSafe for Template
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more