pub struct TemplateConfig<V>where
    V: Clone + Debug + Display + PartialEq + FromStr,{ /* private fields */ }
Expand description

A liquid template configuration that retains portions of its context and can be unrendered into the original template or value.

Implementations§

source§

impl<T> TemplateConfig<T>where T: Clone + Debug + Display + PartialEq + FromStr,

source

pub const fn new_value(value: T) -> Self

Create a new TemplateConfig from a value.

source

pub fn new_template(value: String) -> Self

Create a new TemplateConfig from a template string.

source

pub const fn value(&self) -> Option<&T>

Retrieve a previously rendered value rendered.

source

pub fn set_value(&mut self, value: T)

Set the value rendered held by this configuration to be cached.

source

pub fn value_unchecked(&self) -> &T

Retrieve the previously rendered value or panic.

This should only be used passed the boundary of configuration rendering.

source

pub fn unrender(&self) -> Result<String, ManifestError>

Return a TemplateConfig back to either its template or, if a template, does not exist, its value.

source

pub fn render( &self, source: Option<&Path>, root: Option<&RuntimeConfig>, env: Option<&HashMap<String, String>> ) -> Result<T, Error>

Render a TemplateConfig into the desired value, creating a context from the passed configuration.

Trait Implementations§

source§

impl<V> Clone for TemplateConfig<V>where V: Clone + Debug + Display + PartialEq + FromStr + Clone,

source§

fn clone(&self) -> TemplateConfig<V>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<V> Debug for TemplateConfig<V>where V: Clone + Debug + Display + PartialEq + FromStr + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Default for TemplateConfig<T>where T: Clone + Debug + Display + PartialEq + FromStr + Default,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T> Display for TemplateConfig<T>where T: Clone + Debug + Display + PartialEq + FromStr,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T> Hash for TemplateConfig<T>where T: Clone + Debug + Display + PartialEq + FromStr + Hash,

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<V> PartialEq<TemplateConfig<V>> for TemplateConfig<V>where V: Clone + Debug + Display + PartialEq + FromStr + PartialEq,

source§

fn eq(&self, other: &TemplateConfig<V>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<V> Serialize for TemplateConfig<V>where V: Clone + Debug + Display + PartialEq + FromStr,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<T> Eq for TemplateConfig<T>where T: Clone + Debug + Display + PartialEq + FromStr + Eq,

source§

impl<V> StructuralPartialEq for TemplateConfig<V>where V: Clone + Debug + Display + PartialEq + FromStr,

Auto Trait Implementations§

§

impl<V> RefUnwindSafe for TemplateConfig<V>where V: RefUnwindSafe,

§

impl<V> Send for TemplateConfig<V>where V: Send,

§

impl<V> Sync for TemplateConfig<V>where V: Sync,

§

impl<V> Unpin for TemplateConfig<V>where V: Unpin,

§

impl<V> UnwindSafe for TemplateConfig<V>where V: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
§

impl<C> SignWithKey<String> for Cwhere C: ToBase64,

§

fn sign_with_key(self, key: &impl SigningAlgorithm) -> Result<String, Error>

§

impl<T> ToBase64 for Twhere T: Serialize,

§

fn to_base64(&self) -> Result<Cow<'_, str>, Error>

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<T> Any for Twhere T: Any,

§

impl<T> CloneAny for Twhere T: Any + Clone,

§

impl<T> CloneAnySend for Twhere T: Any + Send + Clone,

§

impl<T> CloneAnySendSync for Twhere T: Any + Send + Sync + Clone,

§

impl<T> CloneAnySync for Twhere T: Any + Sync + Clone,

§

impl<S> ConditionallySend for Swhere S: Send + 'static,

§

impl<S> ConditionallySendSync for Swhere S: Send + Sync + 'static,

source§

impl<T> LocalAwareSend for Twhere T: Send,