pub struct ContextTemplate {
pub name: String,
pub description: String,
pub content: String,
pub variables: Vec<TemplateVariable>,
pub tags: Vec<String>,
pub output_format: OutputFormat,
pub author: Option<String>,
pub version: u32,
pub created_at: u64,
pub updated_at: u64,
}Expand description
A user-defined context template.
Fields§
§name: StringUnique template name (kebab-case).
description: StringHuman-readable description.
content: StringThe template content with {{variable}} placeholders.
variables: Vec<TemplateVariable>Extracted variables with metadata.
Categorization tags.
output_format: OutputFormatDefault output format for rendering.
Author identifier.
version: u32Version number (auto-incremented on save).
created_at: u64Creation timestamp (Unix epoch seconds).
updated_at: u64Last update timestamp (Unix epoch seconds).
Implementations§
Source§impl ContextTemplate
impl ContextTemplate
Sourcepub fn new(name: impl Into<String>, content: impl Into<String>) -> Self
pub fn new(name: impl Into<String>, content: impl Into<String>) -> Self
Creates a new context template with the given name and content.
Variables are automatically extracted from the content and classified as user or auto variables.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets the description.
Sets the tags.
Sets the author.
Sourcepub fn with_variables(self, variables: Vec<TemplateVariable>) -> Self
pub fn with_variables(self, variables: Vec<TemplateVariable>) -> Self
Sets explicit variable definitions, overriding auto-detected ones.
Sourcepub const fn with_version(self, version: u32) -> Self
pub const fn with_version(self, version: u32) -> Self
Sets the version.
Sourcepub fn variable_names(&self) -> Vec<&str>
pub fn variable_names(&self) -> Vec<&str>
Returns the list of variable names in this template.
Sourcepub fn user_variables(&self) -> Vec<&TemplateVariable>
pub fn user_variables(&self) -> Vec<&TemplateVariable>
Returns only user-defined variables (not auto-variables).
Sourcepub fn auto_variables(&self) -> Vec<&TemplateVariable>
pub fn auto_variables(&self) -> Vec<&TemplateVariable>
Returns only auto-variables.
Sourcepub fn has_iteration(&self) -> bool
pub fn has_iteration(&self) -> bool
Checks if the template uses iteration (has {{#each}} blocks).
Sourcepub fn iteration_collections(&self) -> Vec<&str>
pub fn iteration_collections(&self) -> Vec<&str>
Returns the iteration collection names used in the template.
Trait Implementations§
Source§impl Clone for ContextTemplate
impl Clone for ContextTemplate
Source§fn clone(&self) -> ContextTemplate
fn clone(&self) -> ContextTemplate
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ContextTemplate
impl Debug for ContextTemplate
Source§impl Default for ContextTemplate
impl Default for ContextTemplate
Source§fn default() -> ContextTemplate
fn default() -> ContextTemplate
Source§impl<'de> Deserialize<'de> for ContextTemplate
impl<'de> Deserialize<'de> for ContextTemplate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ContextTemplate
impl RefUnwindSafe for ContextTemplate
impl Send for ContextTemplate
impl Sync for ContextTemplate
impl Unpin for ContextTemplate
impl UnwindSafe for ContextTemplate
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].