pub struct Template { /* private fields */ }Expand description
A parsed {{#ns.name.path#}} template.
Implementations§
Source§impl Template
impl Template
Sourcepub fn parse(source: &str) -> Self
pub fn parse(source: &str) -> Self
Parse a template. Anything that is not a well-formed placeholder stays literal text.
pub fn source(&self) -> &str
pub fn parts(&self) -> &[Part]
Sourcepub fn selectors(&self) -> impl Iterator<Item = &Selector>
pub fn selectors(&self) -> impl Iterator<Item = &Selector>
Selectors referenced by this template, in order of appearance.
Sourcepub fn render(&self, pool: &VariablePool) -> String
pub fn render(&self, pool: &VariablePool) -> String
Render to text. Missing variables render as empty text; secrets are masked.
Sourcepub fn render_exposed(&self, pool: &VariablePool) -> String
pub fn render_exposed(&self, pool: &VariablePool) -> String
Render revealing secrets. Only for nodes that must transmit plaintext (e.g. HTTP auth headers).
Sourcepub fn resolve(&self, pool: &VariablePool) -> Value
pub fn resolve(&self, pool: &VariablePool) -> Value
If the template is exactly one placeholder, resolve it to the typed value
(so "{{#llm.json#}}" yields an object rather than its text). Otherwise render text.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Template
impl<'de> Deserialize<'de> for Template
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Template
impl StructuralPartialEq for Template
Auto Trait Implementations§
impl Forget for Template
impl Freeze for Template
impl Move 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.