pub struct StringTemplate { /* private fields */ }
Expand description
A template. The syntax for specifying a variable to be replaced is “~{myname}”.
ⓘ
let mut template = StringTemplate::new("hello ~{name2} my name is ~{name}");
template.set("name", "grok");
template.set("name2", "traveler");
assert!(template.format() == "hello traveler my name is grok");
Implementations§
Trait Implementations§
Source§impl Clone for StringTemplate
impl Clone for StringTemplate
Source§fn clone(&self) -> StringTemplate
fn clone(&self) -> StringTemplate
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Ord for StringTemplate
impl Ord for StringTemplate
Source§fn cmp(&self, other: &StringTemplate) -> Ordering
fn cmp(&self, other: &StringTemplate) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for StringTemplate
impl PartialEq for StringTemplate
Source§impl PartialOrd for StringTemplate
impl PartialOrd for StringTemplate
impl Eq for StringTemplate
impl StructuralPartialEq for StringTemplate
Auto Trait Implementations§
impl Freeze for StringTemplate
impl RefUnwindSafe for StringTemplate
impl Send for StringTemplate
impl Sync for StringTemplate
impl Unpin for StringTemplate
impl UnwindSafe for StringTemplate
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