pub struct Template { /* private fields */ }Expand description
An SVG template plus its placeholder and section substitution.
Implementations§
Source§impl Template
impl Template
Sourcepub fn render<K: AsRef<str>, V: AsRef<str>>(
&self,
data: impl IntoIterator<Item = (K, V)>,
) -> Result<String>
pub fn render<K: AsRef<str>, V: AsRef<str>>( &self, data: impl IntoIterator<Item = (K, V)>, ) -> Result<String>
Resolves sections, then placeholders.
Placeholders come in two forms: {{key}} for text, and __KEY__ for values that are not
XML-escapable content, such as data URIs.
Sections are {{#key}}...{{/key}} and are dropped when the key has no value. They exist because
an optional layer has to disappear entirely rather than render empty: an <image> with
href="" makes a renderer abort, so “no background” cannot mean “background with no source”.
§Errors
Fails when the template cannot be read.
Auto Trait Implementations§
impl Forget for Template
impl Freeze for Template
impl Move for Template
impl RefUnwindSafe for Template
impl Send for Templatewhere
RawVecInner: Send,
impl Sync for Templatewhere
RawVecInner: Sync,
impl Unpin for Template
impl UnsafeUnpin for Template
impl UnwindSafe for Templatewhere
RawVecInner: UnwindSafe,
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